internal async Task <int> DeleteTableEntries() { var entries = await storage.ReadAllTableEntriesForPartitionAsync(GlobalServiceId).ConfigureAwait(false); var entriesList = new List <Tuple <GossipTableEntry, string> >(entries); if (entriesList.Count <= AzureTableDefaultPolicies.MAX_BULK_UPDATE_ROWS) { await storage.DeleteTableEntriesAsync(entriesList).ConfigureAwait(false); } else { List <Task> tasks = new List <Task>(); foreach (var batch in entriesList.BatchIEnumerable(AzureTableDefaultPolicies.MAX_BULK_UPDATE_ROWS)) { tasks.Add(storage.DeleteTableEntriesAsync(batch)); } await Task.WhenAll(tasks).ConfigureAwait(false); } return(entriesList.Count); }