private void moveCurrentSessionToPreviousSession(WindowState state) {

        SessionComplexEventChunk<StreamEvent> currentSession = state.sessionContainer.getCurrentSession();
        SessionComplexEventChunk<StreamEvent> previousSession = state.sessionContainer.getPreviousSession();

        if (previousSession.getFirst() == null) {
            previousSession.add(currentSession.getFirst());

        } else {
            state.expiredEventChunk.setKey(previousSession.getKey());
            state.expiredEventChunk.setTimestamps(previousSession.getStartTimestamp(),
                    previousSession.getEndTimestamp(), previousSession.getAliveTimestamp());
            state.expiredEventChunk.add(previousSession.getFirst());

            previousSession.clear();
            previousSession.add(currentSession.getFirst());

        }
        previousSession.setTimestamps(currentSession.getStartTimestamp(),
                currentSession.getEndTimestamp(),
                currentSession.getAliveTimestamp());
        scheduler.notifyAt(currentSession.getAliveTimestamp());

    }
Moves the events in the current session into previous window.

@param state
modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/SessionWindowProcessor.java