/**
   * Creates a new user.
   *
   * @param firstName The first name of the user
   * @param lastName The last name of the user
   * @param email The email address of the user
   * @param username The username of the user
   * @param password The password of the user
   * @param role The role of the user
   * @return The created user
   */
  public User createUser(
      String firstName,
      String lastName,
      String email,
      String username,
      String password,
      Role role) {
    UserDAO userDAO = DAOFactory.getInstance().getUserDAO();
    InternalAuthDAO internalAuthDAO = DAOFactory.getInstance().getInternalAuthDAO();
    EmailDAO emailDAO = DAOFactory.getInstance().getEmailDAO();

    try {
      String passwordEncoded = EncodingUtils.md5EncodeString(password);
      InternalAuth internalAuth = internalAuthDAO.create(username, passwordEncoded);
      User user =
          userDAO.create(
              firstName, lastName, String.valueOf(internalAuth.getId()), getName(), role);
      // TODO Default contact type?
      emailDAO.create(user.getContactInfo(), null, Boolean.TRUE, email);
      return user;
    } catch (UnsupportedEncodingException e) {
      throw new SmvcRuntimeException(e);
    } catch (NoSuchAlgorithmException e) {
      throw new SmvcRuntimeException(e);
    }
  }
 @Override
 public String createCredentials(String username, String password) {
   InternalAuthDAO internalAuthDAO = DAOFactory.getInstance().getInternalAuthDAO();
   try {
     String newPasswordEncoded = EncodingUtils.md5EncodeString(password);
     InternalAuth internalAuth = internalAuthDAO.create(username, newPasswordEncoded);
     String externalId = internalAuth.getId().toString();
     return externalId;
   } catch (UnsupportedEncodingException e) {
     throw new SmvcRuntimeException(e);
   } catch (NoSuchAlgorithmException e) {
     throw new SmvcRuntimeException(e);
   }
 }