public async Task <ActionResult> Login(LoginModel model, string returnUrl)
        {
            SignOut();
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError(string.Empty, ModelValidations.Account_InvalidLoginError);
                return(View(model));
            }


            var applicationUserClaims = await _activeDirectoryService.ValidateUser(model.DomainName, model.UserName, model.Password);

            //using (var pc = new PrincipalContext(ContextType.Domain, "10.10.52.100"))
            //{
            //    var isValid = pc.ValidateCredentials(model.UserName, model.Password);

            //}
            if (applicationUserClaims != null)
            {
                //Add Role as User Or Admin
                if (model.IsAdmin)
                {
                    //valdiate that It is admin in table

                    applicationUserClaims.Add(new Claim(ClaimTypes.Role, UserRole.Admin.ToString()));
                }
                else
                {
                    applicationUserClaims.Add(new Claim(ClaimTypes.Role, UserRole.User.ToString()));
                }

                var claimsIdentity = new ClaimsIdentity(applicationUserClaims, DefaultAuthenticationTypes.ApplicationCookie);

                ControllerContext.HttpContext.GetOwinContext()
                .Authentication
                .SignIn(new AuthenticationProperties()
                {
                    IsPersistent = true
                }, claimsIdentity);


                if (!string.IsNullOrWhiteSpace(returnUrl) && Url.IsLocalUrl(returnUrl))
                {
                    return(Redirect(returnUrl));
                }

                _logger.Info("user logged in");
                return(RedirectToAction("Index", "Home", new { area = string.Empty }));
            }

            else
            {
                ModelState.AddModelError(string.Empty, ModelValidations.Account_InvalidLoginMessage);
                ModelState.AddModelError(string.Empty, ModelValidations.Account_InvalidLoginMessage1);
            }
            return(View(model));
        }