public void maybeDeleteGroup(String groupId, List<CoordinatorRecord> records) {
        Group group = groups.get(groupId);
        if (group != null && group.isEmpty()) {
            createGroupTombstoneRecords(groupId, records);
        }
    }
Delete the group if it exists and is in Empty state.

@param groupId The group id.
@param records The list of records to append the group metadata tombstone records.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java