public ShareGroupMember getOrMaybeCreateMember(
        String memberId,
        boolean createIfNotExists
    ) {
        ShareGroupMember member = members.get(memberId);
        if (member != null) return member;

        if (!createIfNotExists) {
            throw new UnknownMemberIdException(
                String.format("Member %s is not a member of group %s.", memberId, groupId));
        }

        member = new ShareGroupMember.Builder(memberId).build();
        updateMember(member);
        return member;
    }
Gets or creates a member.

@param memberId          The member id.
@param createIfNotExists Booleans indicating whether the member must be
                         created if it does not exist.

@return A ShareGroupMember.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/modern/share/ShareGroup.java