public async Task Populate() { var sw = new Stopwatch(); sw.Start(); var tasks = (await storage.ReadBundleMetainfos()).Select(info => Task.Run(async() => { try { if (info == null) { return; } bundles[info.BundleId] = info; await dumpRepository.PopulateForBundle(info.BundleId); } catch (Exception e) { Console.Error.WriteLine($"Populating BundleRepository failed for {info.BundleId}: {e}"); } })); await Task.WhenAll(tasks); IsPopulated = true; dumpRepository.SetIsPopulated(); sw.Stop(); Console.WriteLine($"Finished populating BundleRepository in {sw.Elapsed}"); }