public IntacctCustomer(XElement data) { this.SetPropertyValue(x => Id, data); this.SetPropertyValue(x => Name, data); this.SetPropertyValue(x => ExternalId, data, isOptional: true); var primaryContactElement = data.Element("primary"); if (primaryContactElement != null && primaryContactElement.HasElements) { PrimaryContact = new IntacctContact(primaryContactElement); } }