public virtual async Task <IActionResult> SetStore(
            [FromServices] IStoreService storeService,
            string store, string returnUrl = "")
        {
            var currentstoreid = _storeContext.CurrentStore.Id;

            if (currentstoreid != store)
            {
                await _commonViewModelService.SetStore(store);
            }

            var prevStore = await storeService.GetStoreById(currentstoreid);

            var currStore = await storeService.GetStoreById(store);

            if (prevStore != null && currStore != null)
            {
                if (prevStore.Url != currStore.Url)
                {
                    return(Redirect(currStore.SslEnabled ? currStore.SecureUrl : currStore.Url));
                }
            }

            //home page
            if (String.IsNullOrEmpty(returnUrl))
            {
                returnUrl = Url.RouteUrl("HomePage");
            }

            //prevent open redirection attack
            if (!Url.IsLocalUrl(returnUrl))
            {
                returnUrl = Url.RouteUrl("HomePage");
            }

            return(Redirect(returnUrl));
        }