class EventManager implements SyncEngineCallback {

  public void removeQueryListener(QueryListener listener) {
    Query query = listener.getQuery();
    QueryListenersInfo queryInfo = queries.get(query);
    boolean lastListen = false;
    if (queryInfo != null) {
      queryInfo.listeners.remove(listener);
      lastListen = queryInfo.listeners.isEmpty();
    }

    if (lastListen) {
      queries.remove(query);
      syncEngine.stopListening(query);
    }
  }

  public  EventManager(SyncEngine syncEngine);

}