private DateTime MinDate(DateTime newValue, DateTime endValue) { return newValue >= endValue ? endValue : newValue; }