public IActionResult RemoveEmployerJs(string employerIdentifier, string returnUrl)
        {
            //Check the parameters are populated
            if (string.IsNullOrWhiteSpace(employerIdentifier))
            {
                return(new HttpBadRequestResult($"Missing {nameof(employerIdentifier)}"));
            }

            if (string.IsNullOrWhiteSpace(returnUrl))
            {
                return(new HttpBadRequestResult($"Missing {nameof(returnUrl)}"));
            }

            //Get the employer from the encrypted identifier
            EmployerSearchModel employer = GetEmployer(employerIdentifier);

            //Remove the employer from the list
            CompareViewService.RemoveFromBasket(employer.OrganisationIdEncrypted);

            //Save the compared employers to the cookie
            CompareViewService.SaveComparedEmployersToCookie(Request);

            //Setup compare basket
            bool fromSearchResults = returnUrl.Contains("/search-results");
            bool fromEmployer      = returnUrl.StartsWithI("/employer");

            ViewBag.BasketViewModel = new CompareBasketViewModel {
                CanAddEmployers = false,
                CanClearCompare = true,
                CanViewCompare  = fromSearchResults && CompareViewService.BasketItemCount > 1 ||
                                  fromEmployer && CompareViewService.BasketItemCount > 0,
                IsSearchPage   = fromSearchResults,
                IsEmployerPage = fromEmployer
            };

            ViewBag.ReturnUrl = returnUrl;

            var model = new AddRemoveButtonViewModel {
                OrganisationIdEncrypted = employer.OrganisationIdEncrypted, OrganisationName = employer.Name
            };

            return(PartialView("Basket_Button", model));
        }
        public IActionResult RemoveEmployer(string employerIdentifier, string returnUrl)
        {
            //Check the parameters are populated
            if (string.IsNullOrWhiteSpace(employerIdentifier))
            {
                return(new HttpBadRequestResult($"Missing {nameof(employerIdentifier)}"));
            }

            if (string.IsNullOrWhiteSpace(returnUrl))
            {
                return(new HttpBadRequestResult($"Missing {nameof(returnUrl)}"));
            }

            //Get the employer from the encrypted identifier
            EmployerSearchModel employer = GetEmployer(employerIdentifier);

            //Remove the employer from the list
            CompareViewService.RemoveFromBasket(employer.OrganisationIdEncrypted);

            //Save the compared employers to the cookie
            CompareViewService.SaveComparedEmployersToCookie(Request);

            return(LocalRedirect(returnUrl));
        }