public async Task<IHttpActionResult> PasswordSignIn(string userName, string password)
        {
            if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(password))
            {
                return BadRequest();
            }

            using (var signInManager = _signInManagerFactory())
            {
                var status = await signInManager.PasswordSignInAsync(userName, password, false, shouldLockout: true);
                var result = new SignInResult { Status = status };

                if (result.Status == Microsoft.AspNet.Identity.Owin.SignInStatus.Success)
                {
                    var user = await _securityService.FindByNameAsync(userName, UserDetails.Full);

                    //Do not allow to login rejected users
                    if (user != null && user.UserState == AccountState.Rejected)
                    {
                        result.Status = Microsoft.AspNet.Identity.Owin.SignInStatus.LockedOut;
                    }

                }

                return Ok(result);
            }
        }
        public async Task<IHttpActionResult> PasswordSignIn(string userName, string password)
        {
            if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(password))
            {
                return BadRequest();
            }

            var status = await SignInManager.PasswordSignInAsync(userName, password, false, shouldLockout: true);
            var result = new SignInResult { Status = status };

            return Ok(result);
        }