/**
   * @param user
   * @return
   */
  public User registerNewUser(final User user) {

    boolean registered = isUserAlreadyRegistered(user);
    user.setPassword(pwdEncoder.encode(user.getPassword()));

    if (registered) {
      return null;
    }

    userProfileDAO.registerUser(user);

    User newUser = loginDAO.findByEmailId(user.getEmailId());

    return newUser;
  }
 public User getUserDetails(long userId) {
   return userProfileDAO.getUserById(userId);
 }