code: public boolean checkEventId(String conversationId, long conversationEventId, MissingEventsListener missingEventsListener) {
  
          if (!idsPerConversation.containsKey(conversationId)) {
              TreeSet<Long> ids = new TreeSet<>();
              boolean added = ids.add(conversationEventId);
              idsPerConversation.put(conversationId, ids);
              return !added;
          } else {
  
              TreeSet<Long> ids = idsPerConversation.get(conversationId);
  
              long last = ids.last();
              boolean added = ids.add(conversationEventId);
  
              if (last < conversationEventId - 1) {
                  missingEventsListener.missingEvents(conversationId, last + 1, (int) (conversationEventId - last));
              }
  
              while (ids.size() > 10) {
                  ids.pollFirst();
              }
  
              return !added;
          }
      }
docs: Check conversation event id for duplicates or missing events.
  
  @param conversationId      Unique identifier of an conversation.
  @param conversationEventId Unique per conversation, monotonically increasing conversation event id.
  @return True if event with a given id already processed.