public void Authenticate()
        {
            var email = this.RequestUserInput<string>("Enter email: ", string.Empty);
            var password = this.RequestUserInput<string>("Enter password: ", string.Empty);

            var request = new SignInRequest
            {
                Email = email,
                Password = password
            };

            var response = proxy.Authenticate(request);

            this.OutputResponse(response);
        }
        public IHttpActionResult Authenticate(SignInRequest request)
        {
            var response = new SignInResponse();

            try
            {
                if (request.IsValidModel())
                {
                    var member = MembershipAdapter.GetMember(request.Email);

                    if (!member.Authenticate(request.Password))
                    {
                        request.AddError("Password", "Authentication failed");
                    }
                    else
                    {
                        response.MemberId = member.Id.ToString();
                        response.Alias = member.Profile.Alias;
                        response.IsActive = member.IsActive;
                        response.IsAdmin = member.IsAdmin;
                    }
                }

                if (!request.HasErrors())
                {
                    response.IsSuccessful = true;
                    response.StatusMessage = "Sign in succeeded";
                }
                else
                {
                    response.IsSuccessful = false;
                    response.StatusMessage = "Sign in was unsuccessful";
                    response.Errors.AddRange(request.GetErrors());
                }
            }
            catch (Exception ex)
            {
                request.Password = string.Empty;

                this.Log<SignInRequest>(LogCategories.Error, request, ex.Message);

                response.IsSuccessful = false;
                response.StatusMessage = this.StatusMessageForExpection;
                response.Errors.Add(ex.Message);
            }

            return Ok(response);
        }