public ActionResult UserPermission(Permissionviewmodel vm, string Search, string Save)
        {
            List <string>           result      = new List <string>();
            PermissionMaster        _master     = new PermissionMaster();
            List <ModulePermission> p           = new List <ModulePermission>();
            Permissionviewmodel     searchmodel = new Permissionviewmodel();

            Guid CompanyId = new Guid();

            if (Request.Cookies["CompanyId"] != null)
            {
                CompanyId = new Guid(Commonhelper.GetCookie("CompanyId"));
            }
            if (vm.PermissionMaster != null)
            {
                _master.Id          = Guid.NewGuid().ToString();
                _master.CompanyId   = CompanyId.ToString();
                _master.UserId      = vm.PermissionMaster.UserId;
                _master.CreatedBy   = User.Identity.GetUserId();
                _master.DateCreated = DateTime.Now;
                _master.Workstation = Commonhelper.GetStation();
            }
            if (vm.Menumaster.Count() > 0)
            {
                foreach (var item in vm.Menumaster)
                {
                    foreach (var child in item._SubMenumaster)
                    {
                        if (child.IsAdd == true || child.IsEdit == true || child.Isview == true || child.Isdelete == true)
                        {
                            ModulePermission mp = new ModulePermission();
                            mp.Id           = Guid.NewGuid().ToString();
                            mp.MenuId       = item.MenuId;
                            mp.SubMenuId    = child.SubMenumasterId;
                            mp.IsAdd        = child.IsAdd;
                            mp.IsEdit       = child.IsEdit;
                            mp.Isview       = child.Isview;
                            mp.Isdelete     = child.Isdelete;
                            mp.DisplayOrder = child.order;
                            mp.Displayclass = child.Displayclass;
                            mp.DisplayName  = child.DisplayName;
                            _master._ModulePermission.Add(mp);
                        }
                    }
                }
                try
                {
                    Commonhelper.SavePermission(_master);
                    return(Content("<script language='javascript' type='text/javascript'>alert('permission saved successfully!');</script>"));
                }
                catch (Exception ex)
                {
                }
            }
            return(Json(result, JsonRequestBehavior.AllowGet));



            ///return View();
        }