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