/// <summary>
        /// Clean up all the stale workflow runs in the system.
        /// </summary>
        /// <param name="scheduledItemRef"></param>
        public override void Execute(EntityRef scheduledItemRef)
        {
            var      daysToKeepRuns = ConfigurationSettings.GetWorkflowConfigurationSection().Triggers.KeepCompletedRunDays;
            DateTime deleteAfter    = DateTime.UtcNow.AddDays(-daysToKeepRuns);

            var tenant     = RequestContext.GetContext().Tenant;
            var tenantId   = tenant != null ? tenant.Id : 0;
            var tenantName = tenant != null ? tenant.Name : "Zero Tenant";

            EventLog.Application.WriteInformation("Cleaning workflow runs for tenant '{0}' ({1})", tenantName, tenantId);

            RemoveOldWorkflowRuns(deleteAfter);
            RemoveOldWorkflowVersions();
            RemoveUnreferencedWorkflowTraces();
        }