public Permission Map(CreateOrEditViewModel createOrEdit)
        {
            Permission permission = new Permission();

              if (createOrEdit.Id != null)
            permission = this.handler.Storage.GetRepository<IPermissionRepository>().WithKey((int)createOrEdit.Id);

              permission.Code = createOrEdit.Code;
              permission.Name = createOrEdit.Name;
              permission.Position = createOrEdit.Position;
              return permission;
        }
        public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit)
        {
            if (this.ModelState.IsValid)
              {
            Permission permission = new CreateOrEditViewModelMapper(this).Map(createOrEdit);

            if (createOrEdit.Id == null)
              this.Storage.GetRepository<IPermissionRepository>().Create(permission);

            else this.Storage.GetRepository<IPermissionRepository>().Edit(permission);

            this.Storage.Save();
            return this.Redirect(this.Request.CombineUrl("/backend/permissions"));
              }

              return this.CreateRedirectToSelfResult();
        }