code: private void saveUserProfile(Session session, UserProfile profile, boolean broadcast) throws RepositoryException,
        Exception
     {
        Node userNode = utils.getUserNode(session, profile.getUserName());
        Node profileNode = getProfileNode(userNode);
  
        boolean isNewProfile = profileNode.isNew();
  
        if (broadcast)
        {
           preSave(profile, isNewProfile);
        }
  
        writeProfile(profile, profileNode);
  
        session.save();
        putInCache(profile);
  
        if (broadcast)
        {
           postSave(profile, isNewProfile);
        }
     }
docs: Persist user profile to the storage.