code: private User removeUser(Session session, String userName, boolean broadcast) throws Exception
     {
        Node userNode = utils.getUserNode(session, userName);
        User user = readUser(userNode);
  
        if (broadcast)
        {
           preDelete(user);
        }
  
        removeMemberships(userNode, broadcast);
  
        userNode.remove();
        session.save();
  
        removeFromCache(userName);
        removeAllRelatedFromCache(userName);
  
        if (broadcast)
        {
           postDelete(user);
        }
  
        return user;
     }
docs: Remove user and related membership entities.