public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (Have.Count() != Want.Count()) { yield break; } if (Have.All(i => Want.Any(j => j.Id == i.Id)) && Want.All(i => Have.Any(j => j.Id == i.Id))) { yield return(new ValidationResult( "It is not possible to create a trade for the same items.", new[] { "Have", "Want" })); } }