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

            var account = repository
                .FindBy(a => a.Email == model.Email)
                .FirstOrDefault();

              if (account != null)
              {
                  if (PasswordHasher.VerifyPassword(model.Password, account.PasswordHashed))
                  {
                      var claims = new List<Claim>();
                      claims.Add(new Claim(ClaimTypes.Email, model.Email));
                      
                      await Context.Authentication.SignInAsync(
                          CookieAuthenticationDefaults.AuthenticationScheme, 
                          new ClaimsPrincipal(new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme)), 
                          new AuthenticationProperties() { IsPersistent = model.RememberMe }
                      );
                      
                      return string.IsNullOrWhiteSpace(returnUrl) ? (ActionResult)RedirectToAction("Index", "Home") : Redirect(returnUrl);
                  }
              }
              ModelState.AddModelError("", "The user name or password provided is incorrect.");
            return View(model);
        }
        public ActionResult Login(LoginModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            var account = session.QueryOver<Account>()
                    .Where(a => a.Email == model.Email)
                    .List().FirstOrDefault();

            if (account != null)
            {
                if (PasswordHasher.VerifyPassword(model.Password, account.PasswordHashed))
                {
                    FormsAuthentication.SetAuthCookie(model.Email, model.RememberMe);
                    return string.IsNullOrWhiteSpace(returnUrl) ? (ActionResult)RedirectToAction("Index", "Home") : Redirect(returnUrl);
                }
            }
            ModelState.AddModelError("", "The user name or password provided is incorrect.");
            return View(model);
        }