public override async Task <bool> TryDelete(IEnumerable <BenchmarkResult> toRemove) { if (toRemove == null) { throw new ArgumentNullException(nameof(toRemove)); } var benchmarks = Benchmarks; var removeSet = new HashSet <BenchmarkResult>(toRemove); if (removeSet.Count == 0) { return(true); } int n = benchmarks.Length; List <AzureBenchmarkResult> newAzureResults = new List <AzureBenchmarkResult>(n); List <BenchmarkResult> newResults = new List <BenchmarkResult>(n); List <AzureBenchmarkResult> deleteOuts = new List <AzureBenchmarkResult>(); for (int i = 0; i < n; i++) { var b = benchmarks[i]; if (!removeSet.Contains(b)) // remains { var azureResult = ToAzureResult(b, TryGetExternalOutput(b)); newAzureResults.Add(azureResult); newResults.Add(b); } else // to be removed { removeSet.Remove(b); AzureBenchmarkResult ar; if (externalOutputs.TryGetValue(b, out ar)) { deleteOuts.Add(ar); } } } if (removeSet.Count != 0) { throw new ArgumentException("Some of the given results to remove do not belong to the experiment results"); } // Updating blob with results table string newEtag = await Upload(newAzureResults.ToArray()); if (newEtag == null) { return(false); } etag = newEtag; // Update benchmarks array Replace(newResults.ToArray()); (await storage.GetExperiment(ExperimentId)).CompletedBenchmarks = Benchmarks.Count(); // Deleting blobs with output foreach (var ar in deleteOuts) { try { var _ = storage.DeleteOutputs(ar); } catch (Exception ex) { Trace.WriteLine(string.Format("Exception when deleting output: {0}", ex)); } } return(true); }