public ActionResult Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var result = accountManager.Login(model.LoginOrEmail, model.Password, model.RememberMe);

            if (!result.IsSuccess)
            {
                AddErrors(result.Error);
                return(View(model));
            }

            if (model.RememberMe)
            {
                Response.Cookies.Add(CookieHelper.CreateRememberCookie(model.LoginOrEmail));
            }

            if (Url.IsLocalUrl(returnUrl))
            {
                return(Redirect(returnUrl));
            }
            return(RedirectToAction("Index", "Home"));
        }