private AddressData SerializeAddress(Address address) { if (string.IsNullOrEmpty(address.Host) || !address.Port.HasValue) { throw new ArgumentException(string.Format("Address {0} could not be serialized: host or port missing", address)); } return(AddressData.CreateBuilder() .SetHostname(address.Host) .SetPort((uint)address.Port.Value) .SetSystem(address.System) .SetProtocol(address.Protocol) .Build()); }