code: public E persistNewUser(E user, boolean encryptPassword) {
  
          if (user.getId() != null) {
              // to be sure that we are in the
              // "create" case, the id must be null
              return user;
          }
  
          if (encryptPassword) {
              user.setPassword(passwordEncoder.encode(user.getPassword()));
          }
  
          dao.saveOrUpdate(user);
  
          return user;
      }
docs: Persists a new user in the database.
  
  @param user            The user to create
  @param encryptPassword Whether or not the current password of the user object should
  be encrypted or not before the object is persisted in the db
  @return The persisted user object (incl. ID value)