public MvcHtmlString Render()
        {
            var ulTag = new TagBuilder("ul");

            ulTag.AddNotEmptyCssClass(CssClass);
            ulTag.GenerateId(Id);
            ulTag.MergeAttributes(HtmlProperties);
            var itemNumber = 0;

            foreach (var item in Menu.Items)
            {
                itemNumber++;
                var liTag = new TagBuilder("li");
                liTag.AddNotEmptyCssClass(ItemCssClass);
                if (Menu.IsSelected(item))
                {
                    liTag.AddNotEmptyCssClass(SelectedItemCssClass);
                }
                if (itemNumber == 1)
                {
                    liTag.AddNotEmptyCssClass(FirstItemCssClass);
                }
                if (itemNumber == Menu.Items.Count)
                {
                    liTag.AddNotEmptyCssClass(LastItemCssClass);
                }
                if (string.IsNullOrEmpty(item.OnClick))
                {
                    var link = Helper.ActionLink(item.Text, item.Url.ActionName, item.Url.ControllerName ?? string.Empty);
                    liTag.InnerHtml = link.ToHtmlString();
                }
                else
                {
                    // see http://stackoverflow.com/questions/134845/href-tag-for-javascript-links-or-javascriptvoid0
                    liTag.InnerHtml = MvcHtmlString.Create(String.Format("<a onclick=\"{1}\">{0}</a>", item.Text, item.OnClick)).ToHtmlString();
                }
                ulTag.InnerHtml += MvcHtmlString.Create(liTag.ToString(TagRenderMode.Normal));
            }
            return(MvcHtmlString.Create(ulTag.ToString(TagRenderMode.Normal)));
        }