public CommandValidationException(List <ValidationFailure> failures) : this() { var propertyNames = failures .Select(e => e.PropertyName) .Distinct(); foreach (var propertyName in propertyNames) { var propertyFailures = failures .Where(e => e.PropertyName == propertyName) .Select(e => e.ErrorMessage) .Distinct() .ToArray(); Failures.Add(propertyName, propertyFailures); } Errors = Failures.Select(x => x.Key).ToList(); }