public void GenerateSchedule(DateTime startDate, DateTime endDate, Guid?flightId) { if (startDate != null && endDate != null) { _airplaneContext.GenerateSchedule(startDate, endDate, flightId); _airplaneContext.SaveChanges(); } else { throw new AirportServiceException("Couldn't generate schedule. Provided data was invalid."); } }