List<TripHeadsignStopTimeGroupKey> sortedKeys = keyCounts.getSortedKeys();
for (int i = 0; i < sortedKeys.size() - 1; i++) {
TripHeadsignStopTimeGroupKey key = sortedKeys.get(i);
StopTimeGroupBean group = new StopTimeGroupBean();
String groupId = Integer.toString(groups.size());
group.setId(groupId);
String tripHeadsign = key.getTripHeadsign();
group.setTripHeadsign(tripHeadsign);
applyGroupIdForGroupKey(stopTimesForDirection, key, groupId);
groups.add(group);
}