public static MvcHtmlString NavigationListItemRouteLink(this HtmlHelper html, NamedRoute route)
        {
            var li = new TagBuilder("li")
                {
                    InnerHtml = html.RouteLink(route.DisplayName, route.Name).ToString()
                };

            if (CurrentRouteMatchesName(html, route.Name))
            {
                li.AddCssClass("active");
            }
            if (route.Children.Any())
            {
                //TODO: create a UL of child routes here.
                li.AddCssClass("dropdown");
                li.InnerHtml = "<a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">" + route.DisplayName +
                               "<b class=\"caret\"></b></a>";
                var ul = new TagBuilder("ul");
                ul.AddCssClass("dropdown-menu");

                foreach (NamedRoute child in route.Children)
                {
                    var childLi = new TagBuilder("li")
                        {
                            InnerHtml = html.RouteLink(child.DisplayName, child.Name).ToString()
                        };
                    ul.InnerHtml += childLi.ToString();
                }
                //that would mean we need to make some quick

                li.InnerHtml = "<a href='#' class='dropdown-toggle' data-toggle='dropdown'>" + route.DisplayName +
                               " <b class='caret'></b></a>" + ul;
            }
            return MvcHtmlString.Create(li.ToString(TagRenderMode.Normal));
        }
        protected Route WithFormatExtension(Route implicitRoute)
        {
            var namedRoute = implicitRoute as NamedRoute;

            if (namedRoute != null)
            {
                var explicitRoute = new NamedRoute("formatted_" + namedRoute.Name, implicitRoute.Url + ".{format}", implicitRoute.RouteHandler)
                {
                    Constraints = new RouteValueDictionary(implicitRoute.Constraints ?? new RouteValueDictionary()),
                    DataTokens  = new RouteValueDictionary(implicitRoute.DataTokens ?? new RouteValueDictionary()),
                    Defaults    = new RouteValueDictionary(implicitRoute.Defaults ?? new RouteValueDictionary())
                };

                explicitRoute.Constraints.Add("format", @"[A-Za-z0-9]+");

                return(explicitRoute);
            }
            else
            {
                var explicitRoute = new Route(implicitRoute.Url + ".{format}", implicitRoute.RouteHandler)
                {
                    Constraints = new RouteValueDictionary(implicitRoute.Constraints ?? new RouteValueDictionary()),
                    DataTokens  = new RouteValueDictionary(implicitRoute.DataTokens ?? new RouteValueDictionary()),
                    Defaults    = new RouteValueDictionary(implicitRoute.Defaults ?? new RouteValueDictionary())
                };

                explicitRoute.Constraints.Add("format", @"[A-Za-z0-9]+");

                return(explicitRoute);
            }
        }