public async Task <User> Authenticate(AuthenticateModel model) { var user = await _userRepository.GetUserByName(model.Username); AuthHelper.CheckAuthentication(user, model.Password); return(user); }