private async Task <ResourceCollectionInfo> ReadCollection(XmlReaderWrapper reader, Workspace workspace)
        {
            ResourceCollectionInfo result = CreateCollection(workspace);

            result.BaseUri = workspace.BaseUri;
            if (reader.HasAttributes)
            {
                while (reader.MoveToNextAttribute())
                {
                    if (reader.LocalName == "base" && reader.NamespaceURI == Atom10FeedFormatter.XmlNs)
                    {
                        result.BaseUri = FeedUtils.CombineXmlBase(result.BaseUri, await reader.GetValueAsync());
                    }
                    else if (reader.LocalName == App10Constants.Href && reader.NamespaceURI == string.Empty)
                    {
                        result.Link = new Uri(await reader.GetValueAsync(), UriKind.RelativeOrAbsolute);
                    }
                    else
                    {
                        string ns   = reader.NamespaceURI;
                        string name = reader.LocalName;
                        if (FeedUtils.IsXmlns(name, ns) || FeedUtils.IsXmlSchemaType(name, ns))
                        {
                            continue;
                        }

                        string val = await reader.GetValueAsync();

                        if (!TryParseAttribute(name, ns, val, result, this.Version))
                        {
                            if (_preserveAttributeExtensions)
                            {
                                result.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), val);
                            }
                        }
                    }
                }
            }

            XmlBuffer           buffer    = null;
            XmlDictionaryWriter extWriter = null;

            reader.ReadStartElement();
            try
            {
                while (await reader.IsStartElementAsync())
                {
                    if (await reader.IsStartElementAsync(Atom10Constants.TitleTag, Atom10Constants.Atom10Namespace))
                    {
                        result.Title = await new Atom10FeedFormatter().ReadTextContentFromAsync(reader, "//app:service/app:workspace/app:collection/atom:title[@type]", _preserveAttributeExtensions);
                    }
                    else if (await reader.IsStartElementAsync(App10Constants.Categories, App10Constants.Namespace))
                    {
                        result.Categories.Add(await ReadCategories(reader,
                                                                   result.BaseUri,
                                                                   delegate()
                        {
                            return(CreateInlineCategories(result));
                        },

                                                                   delegate()
                        {
                            return(CreateReferencedCategories(result));
                        },
                                                                   this.Version,
                                                                   _preserveElementExtensions,
                                                                   _preserveAttributeExtensions,
                                                                   _maxExtensionSize));
                    }
                    else if (await reader.IsStartElementAsync(App10Constants.Accept, App10Constants.Namespace))
                    {
                        result.Accepts.Add(reader.ReadElementString());
                    }
                    else if (!TryParseElement(reader, result, this.Version))
                    {
                        if (_preserveElementExtensions)
                        {
                            if (buffer == null)
                            {
                                buffer    = new XmlBuffer(_maxExtensionSize);
                                extWriter = buffer.OpenSection(XmlDictionaryReaderQuotas.Max);
                                extWriter.WriteStartElement(Rss20Constants.ExtensionWrapperTag);
                            }

                            await XmlReaderWrapper.WriteNodeAsync(extWriter, reader, false);
                        }
                        else
                        {
                            reader.Skip();
                        }
                    }
                }

                LoadElementExtensions(buffer, extWriter, result);
            }
            finally
            {
                if (extWriter != null)
                {
                    extWriter.Close();
                }
            }

            reader.ReadEndElement();
            return(result);
        }