/// <summary>
        /// Builds the search description.
        /// </summary>
        /// <returns>The search description.</returns>
        private string BuildSearchDescription()
        {
            StringBuilder xml = new StringBuilder();
            using (Utf8EncodedStringWriter encodedStringWriter = new Utf8EncodedStringWriter(xml))
            using (XmlWriter writer = XmlWriter.Create(encodedStringWriter, new XmlWriterSettings { Indent = true }))
            {
                writer.WriteStartDocument();
                writer.WriteStartElement("OpenSearchDescription", "http://a9.com/-/spec/opensearch/1.1/");
                writer.WriteElementString("ShortName", this.FormatShortName());
                writer.WriteElementString("Description", this.FormatDescription());
                writer.WriteStartElement("Url");
                writer.WriteAttributeString("type", "text/html");
                writer.WriteAttributeString("template", this.FormatSearchUrl());
                writer.WriteEndElement();
                writer.WriteEndDocument();
            }

            return xml.ToString();
        }
        /// <summary>
        /// Builds the sitemap.
        /// </summary>
        /// <returns></returns>
        private string BuildSitemap()
        {
            StringBuilder xml = new StringBuilder();
            using (Utf8EncodedStringWriter encodedStringWriter = new Utf8EncodedStringWriter(xml))
            using (XmlWriter writer = XmlWriter.Create(encodedStringWriter, new XmlWriterSettings { Indent = true }))
            {
                // Root of the document
                writer.WriteStartDocument();
                writer.WriteStartElement("urlset", "http://www.sitemaps.org/schemas/sitemap/0.9");

                Macros macros = new Macros();
                Urls urls = new Urls();

                // Home
                WriteSitemapNode(writer, macros.FullUrl(urls.Home), DateTime.Today, "daily", "0.5");

                // Categories
                // Temporary solution for last modified date - use today
                foreach (Category category in CategoryCollection.FetchAll())
                {
                    if (category.IsUncategorized || category.IsDeleted)
                        continue;

                    WriteSitemapNode(writer, macros.FullUrl(category.Url), DateTime.Today, "daily", "0.5");
                }

                // Posts
                PostCollection posts = PostCollection.FetchAll();
                posts.Sort(delegate(Post p1, Post p2)
               	{
               		return Comparer<DateTime>.Default.Compare(p1.Published, p2.Published);
               	});

                foreach (Post post in posts)
                {
                    if (!post.IsPublished || post.IsDeleted || post.IsDirty || post.Published > DateTime.Now)
                        continue;

                    if (post.Category.IsUncategorized && !this.IncludeUncategorizedPosts)
                        continue;

                    WriteSitemapNode(writer, macros.FullUrl(post.Url), post.ModifiedOn, "daily", "0.5");
                }

                writer.WriteEndDocument();
            }

            return xml.ToString();
        }