/// <summary>
        /// The default action to render the front-end view
        /// </summary>
        /// <param name="model"/>
        /// <returns/>
        public async new Task <ActionResult> Index(RenderModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            var viewModel = new JobsRssViewModelFromUmbraco(model.Content).BuildModel();

            // Add common properties to the model
            var expiryDate   = new ExpiryDateFromExamine(model.Content.Id, ExamineManager.Instance.SearchProviderCollection["ExternalSearcher"], new ExpiryDateMemoryCache(TimeSpan.FromHours(1)));
            var modelBuilder = new BaseViewModelBuilder(null);
            await modelBuilder.PopulateBaseViewModel(viewModel, model.Content, null,
                                                     expiryDate.ExpiryDate,
                                                     UmbracoContext.Current.InPreviewMode);

            var jobsProvider = new JobsDataFromApi(new Uri(ConfigurationManager.AppSettings["JobsApiBaseUrl"]), viewModel.JobsSet, viewModel.JobAdvertPage.Url, new HttpClientProvider(), null);
            var jobs         = await jobsProvider.ReadProblemJobs();

            foreach (var job in jobs)
            {
                viewModel.Items.Add(job);
            }

            // Jobs close at midnight, so don't cache beyond then
            var untilMidnightTonight = DateTime.Today.ToUkDateTime().AddDays(1) - DateTime.Now.ToUkDateTime();

            new HttpCachingService().SetHttpCacheHeadersFromUmbracoContent(model.Content, UmbracoContext.Current.InPreviewMode, Response.Cache, new[] { expiryDate }, (int)untilMidnightTonight.TotalSeconds);

            return(CurrentTemplate(viewModel));
        }
        /// <summary>
        /// The default action to render the front-end view
        /// </summary>
        /// <param name="model"/>
        /// <returns/>
        public async new Task <ActionResult> Index(RenderModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            var viewModel = new JobsRssViewModelFromUmbraco(model.Content).BuildModel();

            // Add common properties to the model
            var expiryDate   = new ExpiryDateFromExamine(model.Content.Id, ExamineManager.Instance.SearchProviderCollection["ExternalSearcher"], new ExpiryDateMemoryCache(TimeSpan.FromHours(1)));
            var modelBuilder = new BaseViewModelBuilder(null);
            await modelBuilder.PopulateBaseViewModel(viewModel, model.Content, null,
                                                     expiryDate.ExpiryDate,
                                                     UmbracoContext.Current.InPreviewMode);

            viewModel.Query = new JobSearchQueryConverter(ConfigurationManager.AppSettings["TranslateObsoleteJobTypes"]?.ToUpperInvariant() == "TRUE").ToQuery(Request.QueryString);
            viewModel.Query.ClosingDateFrom = DateTime.Today;
            viewModel.Query.JobsSet         = viewModel.JobsSet;

            var jobsProvider = new JobsDataFromApi(new Uri(ConfigurationManager.AppSettings["JobsApiBaseUrl"]), viewModel.JobsSet, viewModel.JobAdvertPage.Url, new HttpClientProvider(), new MemoryJobCacheStrategy(MemoryCache.Default, Request.QueryString["ForceCacheRefresh"] == "1"));
            var jobs         = await jobsProvider.ReadJobs(viewModel.Query);

            foreach (var job in jobs.Jobs)
            {
                viewModel.Items.Add(job);
            }

            // Jobs close at midnight, so don't cache beyond then.
            // But we reindex every 2 hours, so expire then if it's sooner.
            var untilMidnightTonight = DateTime.Today.ToUkDateTime().AddDays(1) - DateTime.Now.ToUkDateTime();
            var untilNextReindex     = TimeUntilNextReindex();
            var cacheDuration        = untilMidnightTonight > untilNextReindex ? untilNextReindex : untilMidnightTonight;

            new HttpCachingService().SetHttpCacheHeadersFromUmbracoContent(model.Content, UmbracoContext.Current.InPreviewMode, Response.Cache, new[] { expiryDate }, (int)cacheDuration.TotalSeconds);

            return(CurrentTemplate(viewModel));
        }