private void BuildLevel(IDotvvmRequestContext context, HtmlGenericControl container, IEnumerable <IMenuItem> menuItems)
        {
            var stack = container.GetDataContextType();

            foreach (var item in menuItems)
            {
                // create <li>
                var li = new HtmlGenericControl("li");
                li.SetDataContextType(DataContextStack.Create(item.GetType(), stack));
                li.DataContext = item;
                container.Children.Add(li);

                // create <a>
                var link = new HtmlGenericControl("a");
                link.Attributes["href"] = item.NavigateUrl;
                if (item.IsActive)
                {
                    link.Attributes["class"] = "nav-active";
                }
                li.Children.Add(link);

                // create the content
                if (ItemTemplate != null)
                {
                    ItemTemplate.BuildContent(context, link);
                }
                else
                {
                    link.InnerText = item.Text;
                }

                // create child item list
                if (item.ChildItems?.Any() == true)
                {
                    var ul = new HtmlGenericControl("ul");
                    li.Children.Add(ul);
                    BuildLevel(context, ul, item.ChildItems);
                }
            }
        }