/// <summary>
        /// Handles the content service published event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="PublishEventArgs{IContent}"/> containing information about the event.</param>
        private void ContentServicePublished(IPublishingStrategy sender, PublishEventArgs <IContent> e)
        {
            string        alias  = BloodhoundPropertyEditor.PropertyEditorAlias;
            UmbracoHelper helper = new UmbracoHelper(UmbracoContext.Current);

            // Loop through the items and add the url, value pair to the cache.
            foreach (IContent content in e.PublishedEntities)
            {
                IPublishedContent publishedVersion = helper.TypedContent(content.Id);

                IPublishedProperty rewriteProperties =
                    publishedVersion
                    .Properties
                    .FirstOrDefault(p => publishedVersion.ContentType.GetPropertyType(p.PropertyTypeAlias).PropertyEditorAlias.Equals(alias));

                if (rewriteProperties != null)
                {
                    List <BloodhoundUrlRewrite> rewrites = rewriteProperties.GetValue <List <BloodhoundUrlRewrite> >();
                    foreach (BloodhoundUrlRewrite rewrite in rewrites)
                    {
                        UrlRewriteCache.UpdateItem(
                            rewrite.RewriteUrl,
                            new Tuple <IPublishedContent, int>(publishedVersion, rewrite.StatusCode));
                    }
                }
            }
        }
        /// <summary>
        /// Recursively loops through the published content cache one level at a time looking for a matching node.
        /// </summary>
        /// <param name="content">The <see cref="IPublishedContent"/> node currently being checked</param>
        /// <param name="alias">The property alias</param>
        /// <param name="url">The url to search for.</param>
        /// <returns></returns>
        private Tuple <IPublishedContent, int> TryFindRewriteNode(IPublishedContent content, string alias, string url)
        {
            // Check against the property editor alias since we can't enforce strict naming of the property.
            // Or can we?
            IPublishedProperty rewriteProperties = content
                                                   .Properties
                                                   .FirstOrDefault(p => content.ContentType.GetPropertyType(p.PropertyTypeAlias).PropertyEditorAlias.Equals(alias));

            if (rewriteProperties != null)
            {
                // Convert the properties and
                List <BloodhoundUrlRewrite> rewrites = rewriteProperties.GetValue <List <BloodhoundUrlRewrite> >();
                BloodhoundUrlRewrite        rewrite  = rewrites.FirstOrDefault(
                    r =>
                    r.RewriteUrl.InvariantEquals(url) ||
                    (r.IsRegex && new Regex(r.RewriteUrl, RegexOptions.IgnoreCase).IsMatch(url)));

                // It's a result, cache it and return.
                if (rewrite != null)
                {
                    Tuple <IPublishedContent, int> result = new Tuple <IPublishedContent, int>(content, rewrite.StatusCode);
                    UrlRewriteCache.UpdateItem(rewrite.RewriteUrl, result);
                    return(result);
                }
            }

            // Now check any children.
            IEnumerable <IPublishedContent> children = content.Children().AsQueryable();

            if (children.Any())
            {
                return(children.Select(child => this.TryFindRewriteNode(child, alias, url))
                       .FirstOrDefault(result => result != null));
            }

            return(null);
        }