public static async Task WriteAddress(
            this ISyndicationFeedWriter writer,
            IOptions <ResponseOptions> responseOptions,
            AtomFormatter formatter,
            string category,
            AddressSyndicationQueryResult address)
        {
            var item = new SyndicationItem
            {
                Id          = address.Position.ToString(CultureInfo.InvariantCulture),
                Title       = $"{address.ChangeType}-{address.Position}",
                Published   = address.RecordCreatedAt.ToBelgianDateTimeOffset(),
                LastUpdated = address.LastChangedOn.ToBelgianDateTimeOffset(),
                Description = BuildDescription(address, responseOptions.Value.Naamruimte)
            };

            if (address.PersistentLocalId.HasValue)
            {
                // TODO: Hier moet prolly version nog ergens in
                item.AddLink(
                    new SyndicationLink(
                        new Uri($"{responseOptions.Value.Naamruimte}/{address.PersistentLocalId}"),
                        AtomLinkTypes.Related));

                item.AddLink(
                    new SyndicationLink(
                        new Uri(string.Format(responseOptions.Value.DetailUrl, address.PersistentLocalId)),
                        AtomLinkTypes.Self));

                item.AddLink(
                    new SyndicationLink(
                        new Uri(string.Format($"{responseOptions.Value.DetailUrl}.xml", address.PersistentLocalId)), AtomLinkTypes.Alternate)
                {
                    MediaType = MediaTypeNames.Application.Xml
                });

                item.AddLink(
                    new SyndicationLink(
                        new Uri(string.Format($"{responseOptions.Value.DetailUrl}.json",
                                              address.PersistentLocalId)),
                        AtomLinkTypes.Alternate)
                {
                    MediaType = MediaTypeNames.Application.Json
                });
            }

            item.AddCategory(
                new SyndicationCategory(category));

            item.AddContributor(
                new SyndicationPerson(
                    "agentschap Informatie Vlaanderen",
                    "*****@*****.**",
                    AtomContributorTypes.Author));

            await writer.Write(item);
        }
        public static async Task WriteAddress(
            this ISyndicationFeedWriter writer,
            IOptions <ResponseOptions> responseOptions,
            AtomFormatter formatter,
            string category,
            AddressSyndicationQueryResult address)
        {
            var item = new SyndicationItem
            {
                Id          = address.Position.ToString(CultureInfo.InvariantCulture),
                Title       = $"{address.ChangeType}-{address.Position}",
                Published   = address.RecordCreatedAt.ToBelgianDateTimeOffset(),
                LastUpdated = address.LastChangedOn.ToBelgianDateTimeOffset(),
                Description = BuildDescription(address, responseOptions.Value.Naamruimte)
            };

            if (address.PersistentLocalId.HasValue)
            {
                item.AddLink(
                    new SyndicationLink(
                        new Uri($"{responseOptions.Value.Naamruimte}/{address.PersistentLocalId}"),
                        AtomLinkTypes.Related));

                //item.AddLink(
                //    new SyndicationLink(
                //        new Uri(string.Format(responseOptions.Value.DetailUrl, address.PersistentLocalId)),
                //        AtomLinkTypes.Self));

                //item.AddLink(
                //    new SyndicationLink(
                //            new Uri(string.Format($"{responseOptions.Value.DetailUrl}.xml", address.PersistentLocalId)), AtomLinkTypes.Alternate)
                //    { MediaType = MediaTypeNames.Application.Xml });

                //item.AddLink(
                //    new SyndicationLink(
                //            new Uri(string.Format($"{responseOptions.Value.DetailUrl}.json",
                //                address.PersistentLocalId)),
                //            AtomLinkTypes.Alternate)
                //    { MediaType = MediaTypeNames.Application.Json });
            }

            item.AddCategory(
                new SyndicationCategory(category));

            item.AddContributor(
                new SyndicationPerson(
                    address.Organisation == null ? Organisation.Unknown.ToName() : address.Organisation.Value.ToName(),
                    string.Empty,
                    AtomContributorTypes.Author));

            await writer.Write(item);
        }
        private static string BuildDescription(AddressSyndicationQueryResult address, string naamruimte)
        {
            if (!address.ContainsEvent && !address.ContainsObject)
            {
                return("No data embedded");
            }

            var content = new SyndicationContent();

            if (address.ContainsObject)
            {
                content.Object = new AddressSyndicationContent(
                    address.AddressId,
                    naamruimte,
                    address.StreetNameId,
                    address.PersistentLocalId,
                    address.HouseNumber,
                    address.BoxNumber,
                    address.PostalCode,
                    address.PointPosition == null ? null : AddressMapper.GetAddressPoint(address.PointPosition),
                    address.GeometryMethod == null ? (PositieGeometrieMethode?)null : AddressMapper.ConvertFromGeometryMethod(address.GeometryMethod.Value),
                    address.GeometrySpecification == null ? (PositieSpecificatie?)null : AddressMapper.ConvertFromGeometrySpecification(address.GeometrySpecification.Value),
                    address.Status.ConvertFromAddressStatus(),
                    address.LastChangedOn.ToBelgianDateTimeOffset(),
                    address.IsComplete,
                    address.IsOfficiallyAssigned,
                    address.Organisation,
                    address.Reason);
            }

            if (address.ContainsEvent)
            {
                var doc = new XmlDocument();
                doc.LoadXml(address.EventDataAsXml);
                content.Event = doc.DocumentElement;
            }

            return(content.ToXml());
        }