code: private Node getOrCreateMembershipTypeNode(Session session, MembershipTypeImpl mType) throws Exception
     {
        try
        {
           return mType.getInternalId() != null ? session.getNodeByUUID(mType.getInternalId()) : utils
              .getMembershipTypeNode(session, mType.getName());
        }
        catch (ItemNotFoundException e)
        {
           return createNewMembershipTypeNode(session, mType);
        }
        catch (PathNotFoundException e)
        {
           return createNewMembershipTypeNode(session, mType);
        }
     }
docs: Creates and returns membership type node. If node already exists it will be returned
  otherwise the new one will be created.