public async virtual Task <IActionResult> ChangeScheduler(string schedulerName)
        {
            if (!await GlobalizationHelper.IsValidSchedulerName(schedulerName))
            {
                throw new Exception("Unknown scheduler: " + schedulerName + ". It must be a valid scheduler!");
            }

            string cookieValue = Crypto.DesEncrypt(schedulerName);

            Response.Cookies.Append(
                HybridConsts.SchedulerCookieName,
                cookieValue,
                new CookieOptions
            {
                Expires  = DateTime.UtcNow.AddYears(2),
                HttpOnly = true
            }
                );

            if (Request.IsAjaxRequest())
            {
                return(Json(new AjaxResult()));
            }

            string queryString = Request.QueryString.Value;

            string returnUrl = queryString.Split("returnUrl=")[1];

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

            return(Redirect("/")); //: Go to app root
        }