@Override
  public void setOption(User user, String key, String value) {

    // TODO better design?
    for (UserOption currentOption : user.getOptions()) {
      if (currentOption.getKey().equals(key)) {
        if (!currentOption.getValue().equals(value)) {
          currentOption.setValue(value);
          userDao.update(user);
          return;
        }
      }
    }
    user.getOptions().add(new UserOption(key, value));
    userDao.update(user);
    return;
  }
  @Override
  public User createUser(String username, String password, String email) {

    validate(username, password, email);
    try {
      String encryptedPassword = PasswordUtils.encrypt(password);

      // TODO check username unique

      // TODO check email is unique
      User u = new User();
      u.setUsername(username);
      u.setPassword(encryptedPassword);
      u.setEmail(email);
      create(u);
      return u;
    } catch (NoSuchAlgorithmException e) {
      e.printStackTrace();
    }
    return null;
  }
 @Override
 public User select(User user) {
   return (User) gs().get(User.class, user.getId());
 }