code: private MembershipType createMembershipType(Session session, MembershipTypeImpl mt, boolean broadcast)
        throws Exception
     {
        Node storageTypesNode = utils.getMembershipTypeStorageNode(session);
        Node typeNode = storageTypesNode.addNode(mt.getName().equals(MembershipTypeHandler.ANY_MEMBERSHIP_TYPE)
           ? JCROrganizationServiceImpl.JOS_MEMBERSHIP_TYPE_ANY : mt.getName());
  
        mt.setInternalId(typeNode.getUUID());
  
        if (broadcast)
        {
           preSave(mt, true);
        }
  
        writeMembershipType(mt, typeNode);
        session.save();
  
        putInCache(mt);
  
        if (broadcast)
        {
           postSave(mt, true);
        }
  
        return mt;
     }
docs: Persists new membership type object.