public static EntryEventImpl getLastTransactionEventInGroupedTxForWANSender(
      List<EntryEventImpl> callbacks, Cache cache) throws ServiceConfigurationError {
    if (checkNoSendersGroupTransactionEvents(callbacks, cache)) {
      return null;
    }

    List<Set> senderIdsPerEvent = getGroupingSendersPerEvent(callbacks, cache);
    if (senderIdsPerEvent.stream().distinct().count() > 1) {
      String info = eventsAndSendersPerEventToString(callbacks, senderIdsPerEvent);
      throw new ServiceConfigurationError(
          "Not all events go to the same senders that group transactions. " + info);
    }

    return callbacks.get(callbacks.size() - 1);
  }
@param callbacks list of events belonging to a transaction

@return the last event of the transaction.
        If the regions to which the events belong do not have senders
        that group transactions it returns null.
        If the regions to which the
        events belong have different sets of senders that group transactions
        then it throws a ServiceConfigurationError exception.
geode-core/src/main/java/org/apache/geode/internal/cache/TXLastEventInTransactionUtils.java