public static void ValidatesWhen(this IValidatable source, bool condition, [CallerMemberName] string propertyName = "", string errorText = "") { if (condition) { source.RemoveError(propertyName); return; } source.SetError(propertyName, errorText); }