code: private MembershipType removeMembershipType(Session session, String name, boolean broadcast)
        throws RepositoryException, Exception
     {
        Node membershipTypeNode = utils.getMembershipTypeNode(session, name);
        MembershipType type = readMembershipType(membershipTypeNode);
  
        if (broadcast)
        {
           preDelete(type);
        }
  
        removeMemberships(membershipTypeNode);
        membershipTypeNode.remove();
        session.save();
  
        removeFromCache(name);
        removeAllRelatedFromCache(name);
  
        if (broadcast)
        {
           postDelete(type);
        }
  
        return type;
     }
docs: Removing membership type and related membership entities.