public void SetExitCustomsOffice(ExitCustomsOffice customsOffice) { var customsOfficeRequiredStatus = requiredCustomsOffices.Value.GetForTransportRoute(this); switch (customsOfficeRequiredStatus) { case CustomsOffices.EntryAndExit: case CustomsOffices.Exit: this.ExitCustomsOffice = customsOffice; break; default: throw new InvalidOperationException("Cannot set an exit customs office for Notification " + this.Id + ". The Notification only requires the following customs offices: " + customsOfficeRequiredStatus); } }