public PermissionViewModel Build(Permission permission)
 {
     return new PermissionViewModel()
       {
     Id = permission.Id,
     Name = permission.Name,
     Position = permission.Position
       };
 }
        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 RolePermissionViewModel Build(Role role, Permission permission)
        {
            RolePermission rolePermission = null;

              if (role != null)
            rolePermission = this.handler.Storage.GetRepository<IRolePermissionRepository>().WithKey(role.Id, permission.Id);

              return new RolePermissionViewModel()
              {
            Permission = new PermissionViewModelBuilder(this.handler).Build(permission),
            IsAssigned = rolePermission != null
              };
        }