public void SaveResultsToDB(IEnumerable <BatchCreationResult> results) { if (_resultsSaved) { throw new InvalidOperationException("Attemption to save results in Manager that already has saved results. Each instance of BatchCreationManager allows saving only one time."); } _resultsSaved = true; var Msgs = results.SelectMany(x => x.Messages); if (Msgs.Any()) { Logic.AddRange(results.Select(x => x.Batch)); Logic.AddRange(Msgs); Logic.AddRange(results.SelectMany(x => x.SendQueue)); } if (_MakeTimeStamp) { WriteEndDate(periodEnd); } }