public async Task PublishStagedReleaseContent([TimerTrigger("%PublishReleaseContentCronSchedule%")]
                                                      TimerInfo timer,
                                                      ExecutionContext executionContext,
                                                      ILogger logger)
        {
            logger.LogInformation("{0} triggered at: {1}",
                                  executionContext.FunctionName,
                                  DateTime.UtcNow);

            var scheduled = (await QueryScheduledReleases()).ToList();

            if (scheduled.Any())
            {
                var published = new List <ReleasePublishingStatus>();
                foreach (var releaseStatus in scheduled)
                {
                    logger.LogInformation("Moving content for release: {0}",
                                          releaseStatus.ReleaseId);
                    await UpdateStage(releaseStatus, Started);

                    try
                    {
                        await _publishingService.PublishStagedReleaseContent(releaseStatus.ReleaseId,
                                                                             releaseStatus.PublicationSlug);

                        published.Add(releaseStatus);
                    }
                    catch (Exception e)
                    {
                        logger.LogError(e, "Exception occured while executing {0}",
                                        executionContext.FunctionName);
                        await UpdateStage(releaseStatus, Failed,
                                          new ReleasePublishingStatusLogMessage($"Exception in publishing stage: {e.Message}"));
                    }
                }

                var releaseIds = published.Select(status => status.ReleaseId).ToArray();

                try
                {
                    if (!EnvironmentUtils.IsLocalEnvironment())
                    {
                        await _releaseService.DeletePreviousVersionsStatisticalData(releaseIds);
                    }

                    // Invalidate the cached trees in case any methodologies/publications
                    // are now accessible for the first time after publishing these releases
                    await _contentService.DeleteCachedTaxonomyBlobs();

                    await _contentService.DeletePreviousVersionsDownloadFiles(releaseIds);

                    await _contentService.DeletePreviousVersionsContent(releaseIds);

                    await _notificationsService.NotifySubscribersIfApplicable(releaseIds);

                    await UpdateStage(published, Complete);
                }
                catch (Exception e)
                {
                    logger.LogError(e, "Exception occured while executing {0}",
                                    executionContext.FunctionName);
                    await UpdateStage(published, Failed,
                                      new ReleasePublishingStatusLogMessage($"Exception in publishing stage: {e.Message}"));
                }
            }

            logger.LogInformation(
                "{0} completed. {1}",
                executionContext.FunctionName,
                timer.FormatNextOccurrences(1));
        }