public ActionResult Create(Permission model, FormCollection collection)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    Permission item = new Permission();
                    item.ViewId = model.ViewId;
                    item.FieldId = model.FieldId;
                    item.PermissionTypeId = model.PermissionTypeId;
                    Repository.Add(item);
                    Repository.Save();
                    return RedirectToAction("Index", new { id = model.ViewId });
                }
                ViewBag.PermissionTypes = new SelectList(Repository.GetPermissionTypes(), "PermissionTypeId", "Name");
                return View(model);

            }
            catch
            {
                Permission model2 = new Permission();
                model2.ViewId = model.ViewId;
                ViewBag.PermissionTypes = new SelectList(Repository.GetPermissionTypes(), "PermissionTypeId", "Name");
                return View(model2);
            }
        }
 //
 // GET: /Permissions/Create
 public ActionResult Create(int id)
 {
     RepositoryViews repository = new RepositoryViews();
     Permission model = new Permission();
     model.ViewId = id;
     model.View = repository.Get(id);
     ViewBag.PermissionTypes = new SelectList(Repository.GetPermissionTypes(), "PermissionTypeId", "Name");
     return View(model);
 }