public async Task <UserCreatedVM> CreateUser(UserToCreateVM userToCreate) { var user = _mapper.Map <User>(userToCreate); user.Hkey = Guid.NewGuid().ToString(); byte[] passwordSalt; byte[] passwordHash; userToCreate.Password.CreatePasswordHash(out passwordSalt, out passwordHash); user.PasswordSalt = passwordSalt; user.PasswordHash = passwordHash; var userCreated = await _authenticationRepository.CreateUser(user); return(_mapper.Map <UserCreatedVM>(userCreated)); }