private bool ValidateSources() { IDictionary <DistributionSource, List <string> > invalidSources = DistributionSources .Select(source => new { Source = source, Messages = DistributionSourceIsValid(source).ToList() }) .Where(x => x.Messages.Count > 0) .ToDictionary(x => x.Source, x => x.Messages); if (invalidSources.Count > 0) { int invalidSourceCount = invalidSources.Keys.Count; Messenger.ShowError($"Distribution source{(invalidSourceCount == 1 ? string.Empty : "s")} invalid", "One or more distribution source property invalid. See details for more information.", invalidSources.Aggregate(string.Empty, (x, y) => x + Environment.NewLine + Environment.NewLine + y.Value.Select(z => new { Source = y.Key, Message = z }) .Aggregate(string.Empty, (a, b) => a + Environment.NewLine + Machine + " > " + Application + ": " + b.Message).Trim()).Trim()); return(false); } return(true); }