{
username = ValidationUtils.assertNotEmpty(username, "username cannot be empty");
hashedPassword = ValidationUtils.assertNotEmpty(hashedPassword, "hashedPassword cannot be empty");
if (findByUsername(username) != null)
throw new DuplicateUserException("username already exists: " + username);
User user = userDao.save(new User(username, hashedPassword));
if (callbacks != null)
{