public ActionResult List(int page, int rows, string sidx, string sord, int? ParentId, string Position)
        {
            var navigations = new NavigationService().List(ParentId, Position);
            bool searchOn = bool.Parse(Request.Form["_search"]);
            string searchExp = "";

            var model = from entity in navigations.OrderBy(sidx + " " + sord)
                        select new
                        {
                            Id = entity.Id,
                            Name = entity.Name,
                            Component = entity.Component,
                            Url= GetUrl(entity),
                            DisplayOrder = entity.DisplayOrder
                        };
            return Json(model.ToJqGridData(page, rows, null, "", new[] { "Name" }), JsonRequestBehavior.AllowGet);
        }
        public ActionResult TreeNode(string Node, FormCollection collection)
        {
            IEnumerable<Navigation> navigations = null;
            if (string.IsNullOrEmpty(Node ))
            {
             var items = from p in CustomSelectList.CreateMenuPosition()
                             select new
                            {
                                text = p.Text,
                                hasChildren = true,
                                id = p.Value,
                                classes = "Clickable"
                            };
                return  Json(items);
                        
            }
            int parentId = 0;
            NavigationService service = new NavigationService();

            if(int.TryParse(Node, out parentId)) {
                navigations = service.List(parentId,"");
            }
            else
            {
                navigations = service.GetItems(Node);
            }
            var query = from p in navigations
                        select new
                        {
                            text = p.Name,
                            hasChildren = p.Navigations.Count > 0,
                            id = p.Id.ToString(),
                            classes = "Clickable"
                        };

            return Json(query);
        }
        //
        // GET: /Navigation/Edit/5
 
        public ActionResult Edit(int id)
        {
            Navigation nav = new NavigationService().GetItem(id);
            ViewData["ExtraData"] = new NavigationDataView()
            {
                Categories = CustomSelectList.CreateListCategories(true, nav.CategoryId),
                NavigationPositions = CustomSelectList.CreateMenuPosition(nav.Position),
                RootNavigations = CustomSelectList.CreateListNavigations(true, nav.ParentId),
                SiteModules = CustomSelectList.CreateModuleList(nav.Component),
                OrphanArticles = CustomSelectList.CreateListOphanArticles(),
                Departments = CustomSelectList.CreateDepartments()
                
            };
            
            return View(nav);
        }