private async Task <int> DeleteDocuments(AzureSearchQuery query)
        {
            var defaultIndexName   = _azureSearchService.GetDefaultIndexName <T>();
            var documentsOlderThan = await _azureSearchService.SearchAsync <SearchDocument>(query, defaultIndexName);

            await _azureSearchService.DeleteAsync(documentsOlderThan.Results.Select(r => r.Document).ToArray(), defaultIndexName);

            return(documentsOlderThan.Results.Count);
        }
        private void DeletePageTreeFromIndex(IContent root)
        {
            var documentsToRemoveFromIndex = _pageDocumentsProvider.GetPageTreeAllLanguagesDocuments(root, true);

            Task.Run(() => _azureSearchService.DeleteAsync(documentsToRemoveFromIndex.ToArray()));
        }