@Transactional
public AuthenticatedUserToken createUser(CreateUserRequest request, Role role) {
validate(request);
User searchedForUser = userRepository.findByEmailAddress(request.getUser().getEmailAddress());
if (searchedForUser != null) {
throw new DuplicateUserException();
}
User newUser = createNewUser(request, role);
AuthenticatedUserToken token = new AuthenticatedUserToken(newUser.getUuid().toString(), createAuthorizationToken(newUser).getToken());
userRepository.save(newUser);