/**
   * Stream the data into an existing session
   *
   * @param session
   * @param context
   * @return
   * @throws IOException
   * @throws ClassNotFoundException
   */
  public static ReteooStatefulSession readSession(
      ReteooStatefulSession session, MarshallerReaderContext context)
      throws IOException, ClassNotFoundException {
    boolean multithread = context.readBoolean();
    long time = context.readLong();
    int handleId = context.readInt();
    long handleCounter = context.readLong();
    long propagationCounter = context.readLong();

    // these are for the InitialFactHandle, on a reset we just ignore
    context.readInt();
    context.readLong();

    session.reset(handleId, handleCounter, propagationCounter);
    DefaultAgenda agenda = (DefaultAgenda) session.getAgenda();

    readAgenda(context, agenda);

    return readSession(session, agenda, time, multithread, context);
  }