public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            ViewResult v = filterContext.Result as ViewResult;

            if (v != null) // v will null when v is not a ViewResult
            {
                Layout bvm = v.Model as Layout;
                if (bvm != null)//bvm will be null when we want a view without Header and footer
                {
                    List <Menu>       lstMenu       = null;
                    MenuBL            objMenuBL     = null;
                    List <BreadCrumb> lstBreadCrumb = null;
                    try
                    {
                        objMenuBL     = new MenuBL();
                        lstBreadCrumb = new List <BreadCrumb>();
                        lstMenu       = objMenuBL.Get(new MenuFilter()
                        {
                            PageSize = null
                        });
                        //string action = filterContext.RouteData.Values["action"].ToString();
                        string action = v.ViewName;
                        if (string.IsNullOrEmpty(action))
                        {
                            action = filterContext.ActionDescriptor.ActionName;
                        }
                        //string controller = filterContext.RouteData.Values["controller"].ToString();
                        string controller = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName;

                        foreach (Menu item in lstMenu)
                        {
                            if (item.Controller == controller && item.Action == action)
                            {
                                item.ActiveClass = " active";
                                Menu objParentMenu = null;
                                int  parentId      = item.ParentId;
                                lstBreadCrumb.Add(new BreadCrumb()
                                {
                                    Name = item.Title, Controller = item.Controller, Action = item.Action, IconClass = item.IconClass
                                });
                                if (item.MenuId != 1)
                                {
                                    do
                                    {
                                        objParentMenu = lstMenu.FirstOrDefault(r => r.MenuId == parentId);
                                        lstBreadCrumb.Add(new BreadCrumb()
                                        {
                                            Name = objParentMenu.Title, Controller = Convert.ToString("" + objParentMenu.Controller), Action = Convert.ToString("" + objParentMenu.Action), IconClass = objParentMenu.IconClass
                                        });
                                        parentId = objParentMenu.ParentId;
                                    }while (parentId != 0);
                                    objParentMenu = lstMenu.FirstOrDefault(r => r.MenuId == 1);
                                    lstBreadCrumb.Add(new BreadCrumb()
                                    {
                                        Name = objParentMenu.Title, Controller = Convert.ToString("" + objParentMenu.Controller), Action = Convert.ToString("" + objParentMenu.Action), IconClass = objParentMenu.IconClass
                                    });
                                }
                                bvm.PageDescription = Convert.ToString("" + item.Description);
                                bvm.PageTitle       = Convert.ToString("" + item.MenuHeading);
                                break;
                            }
                        }
                        bvm.lstMenu       = lstMenu;
                        bvm.lstBreadCrumb = lstBreadCrumb;
                        bvm.UserName      = HttpContext.Current.User.Identity.Name;
                        bvm.CompanyName   = "KD";
                        bvm.Year          = DateTime.Now.Year.ToString();
                    }
                    catch (Exception ex)
                    {
                        throw;
                    }
                    finally
                    {
                        lstMenu       = null;
                        objMenuBL     = null;
                        lstBreadCrumb = null;
                    }
                }
            }
        }