public async Task <UserAccount> ValidateCredentialsAsync(AuthParams param) { var user = await session.Query <UserAccount>() .SingleOrDefaultAsync(u => u.Login == param.Login); return(user == null ? null : hashService.CompareHashes(param.Password, user.PasswordHash) ? user : null); }