public AuthenticationResponse Authenticate(ISession session, AuthenticationRequest request)
        {
            var response = request.CreateResponse<AuthenticationResponse>();
            
            response.Result = AuthenticationResponseType.Success;

            using (var uow = UnitOfWorkFactory.Create())
            {
                var user = uow.UsersRepository.FirstMatching(UserSpecification.NameAndPassword(request.Name, request.Password));
                if (user == null)
                {
                    response.Result = AuthenticationResponseType.InvalidNameOrPassword;
                    return response;
                }
                else
                {
                    if (user.IsBanned)
                    {
                    }
                    else if (user.Huid != request.Huid)
                    {
                        user.ChangeHuid(request.Huid);
                    }
                }
                
                uow.Commit();
                
                if (response.Result == AuthenticationResponseType.Success)
                {
                    Enumerable.Count(user.Friends);
                    session.SetUser(user);
                    response.User = user.ProjectedAs<UserDto>();
                }
            }
            return response;
        }
 public Task<AuthenticationResponse> Authenticate(AuthenticationRequest request)
 {
     return ConnectionManager.SendRequestAndWaitResponse<AuthenticationResponse>(request);
 }