code: public FogbugzEvent getLastAssignedToGatekeepersEvent(int caseId) {
          List<FogbugzEvent> eventList = this.getEventsForCase(caseId);
          Collections.sort(eventList);
          Collections.reverse(eventList);
  
          for (FogbugzEvent ev : eventList) {
              int person = ev.getPerson();
              if (ev.getPersonAssignedTo() == this.gatekeeperUserId
                      && person != this.gatekeeperUserId
                      && person != this.mergekeeperUserId) {
                  return ev;
              }
          }
  
          return null;
      }
docs: Loop through all FogbugzEvent for given case id, and return last (in time) with assignment to gatekeepers.
  @param caseId
  @return Last event with gatekeeper assignment or null.