private async Task ImportBuildManifestAsync(ProdConTrackerDbContext db, LibGit2Sharp.Blob blob, string branch, Commit commit, HashSet <string> loadedBuilds) { var orchBuild = BuildXmlLoader.Load(blob.GetContentText(), branch); // Check if the build already exists if (!loadedBuilds.Contains(orchBuild.OrchestratedBuildId) && !await db.OrchestratedBuilds.AnyAsync(b => b.OrchestratedBuildId == orchBuild.OrchestratedBuildId)) { _logger.LogInformation("Importing build {BuildId} ...", orchBuild.OrchestratedBuildId); db.OrchestratedBuilds.Add(orchBuild); foreach (var build in orchBuild.Builds) { db.Builds.Add(build); } _logger.LogInformation("Saving to database..."); await db.SaveChangesAsync(); } }