public CoordinatorResult<LeaveGroupResponseData, CoordinatorRecord> classicGroupLeave(
        RequestContext context,
        LeaveGroupRequestData request
    ) throws UnknownMemberIdException {
        Group group;
        try {
            group = group(request.groupId());
        } catch (GroupIdNotFoundException e) {
            throw new UnknownMemberIdException(String.format("Group %s not found.", request.groupId()));
        }

        if (group.type() == CLASSIC) {
            return classicGroupLeaveToClassicGroup((ClassicGroup) group, context, request);
        } else {
            return classicGroupLeaveToConsumerGroup((ConsumerGroup) group, context, request);
        }
    }
Handle a classic LeaveGroupRequest.

@param context        The request context.
@param request        The actual LeaveGroup request.

@return The LeaveGroup response and the records to append.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java