code: private MembershipType saveMembershipType(Session session, MembershipTypeImpl mType, boolean broadcast)
        throws Exception
     {
        Node mtNode = getOrCreateMembershipTypeNode(session, mType);
  
        boolean isNew = mtNode.isNew();
  
        if (broadcast)
        {
           preSave(mType, isNew);
        }
  
        String oldType =
           mtNode.getName().equals(JCROrganizationServiceImpl.JOS_MEMBERSHIP_TYPE_ANY) ? ANY_MEMBERSHIP_TYPE : mtNode
              .getName();
        String newType = mType.getName();
  
        if (!oldType.equals(newType))
        {
           String oldPath = mtNode.getPath();
           String newPath = utils.getMembershipTypeNodePath(newType);
  
           session.move(oldPath, newPath);
  
           moveMembershipsInCache(oldType, newType);
           removeFromCache(oldType);
        }
  
        writeMembershipType(mType, mtNode);
        session.save();
  
        putInCache(mType);
  
        if (broadcast)
        {
           postSave(mType, isNew);
        }
  
        return mType;
     }
docs: Persists new membership type entity.