@Override
 @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
 public void updateUserPassword(User user) {
   PasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
   String hashedPassword = passwordEncoder.encode(user.getPassword());
   user.setPassword(hashedPassword);
   userDao.updateUser(user);
 }
 @Override
 @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
 public void updateUser(User user) throws UserAlreadyExistsException {
   if (userDao.findDuplicateUserByUserName(user.getUsername(), user.getUserId()).size() > 0)
     throw new UserAlreadyExistsException(user.getUsername());
   else {
     userDao.updateUser(user);
   }
 }
 @Override
 public void updateLastVisitDate(User user) {
   user.setLastVisitDate(new Date());
   userDao.updateUser(user);
 }