public static void OnlyExistingItemsAreSelected <TOwner, TTarget, TSource, TVM>( this ValidatorBuilder < TOwner, TTarget, SingleSelectionVMDescriptor <TSource, TVM> > builder, string errorMessage = null, object details = null ) where TTarget : IViewModel <SingleSelectionVMDescriptor <TSource, TVM> > where TOwner : IViewModel where TVM : IViewModel, IHasSourceObject <TSource> { errorMessage = errorMessage ?? Localized.SelectedItemsNotInSourceItems; builder.Check(x => x.SelectedItem).Custom(args => { var selectionVM = args.Target; if (args.Value != null) { if (!SelectionHelpers.IsItemContainedInAllSourceItems(selectionVM, args.Value.Source)) { args.AddError(errorMessage, details); } } }); }