private static void EnterEndDate() { bool endDateTimeIsValid = false; while (!endDateTimeIsValid) { ConsolePrinter.PrintEnterEndDate(); string strEndDateTime = Console.ReadLine(); if (string.IsNullOrWhiteSpace(strEndDateTime)) { endDateTimeIsValid = true; lastSearchCriteria.EndDateTime = null; break; } if (DateTimeHelper.TryParseDateTime(strEndDateTime, out DateTime dateTime)) { endDateTimeIsValid = true; lastSearchCriteria.EndDateTime = dateTime; } else { ConsolePrinter.PrintInvalidEndDate(); } } }