/// <inheritdoc/>
        public async override Task <int> PurgeHistoryByFilters(DateTime createdTimeFrom, DateTime?createdTimeTo, IEnumerable <OrchestrationStatus> runtimeStatus)
        {
            AzureStorage.PurgeHistoryResult purgeHistoryResult =
                await this.serviceClient.PurgeInstanceHistoryAsync(createdTimeFrom, createdTimeTo, runtimeStatus);

            return(purgeHistoryResult.InstancesDeleted);
        }
        /// <inheritdoc/>
        public async override Task <PurgeHistoryResult> PurgeInstanceHistoryByInstanceId(string instanceId)
        {
            AzureStorage.PurgeHistoryResult purgeHistoryResult =
                await this.serviceClient.PurgeInstanceHistoryAsync(instanceId);

            return(new PurgeHistoryResult(purgeHistoryResult.InstancesDeleted));
        }
        /// <inheritdoc />
        public override async Task <PurgeHistoryResult> PurgeInstanceHistoryAsync(DateTime createdTimeFrom, DateTime?createdTimeTo, IEnumerable <OrchestrationStatus> runtimeStatus)
        {
            // TODO this cast is to avoid to change DurableTask.Core. Change it to use TaskHubClient.
            AzureStorageOrchestrationService serviceClient = (AzureStorageOrchestrationService)this.client.ServiceClient;

            DurableTask.AzureStorage.PurgeHistoryResult purgeHistoryResult =
                await serviceClient.PurgeInstanceHistoryAsync(createdTimeFrom, createdTimeTo, runtimeStatus);

            return(new PurgeHistoryResult(purgeHistoryResult.InstancesDeleted));
        }
        /// <inheritdoc />
        public override async Task <PurgeHistoryResult> PurgeInstanceHistoryAsync(string instanceId)
        {
            // TODO this cast is to avoid to change DurableTask.Core. Change it to use TaskHubClient.
            AzureStorageOrchestrationService serviceClient = (AzureStorageOrchestrationService)this.client.ServiceClient;

            DurableTask.AzureStorage.PurgeHistoryResult purgeHistoryResult =
                await serviceClient.PurgeInstanceHistoryAsync(instanceId);

            return(new PurgeHistoryResult(purgeHistoryResult.InstancesDeleted));
        }