public T update(T model) { if (!policy.checkUpdate(model.ID)) { throw new UnauthorizedException("You do not have permission to update this resource."); } // adding update restriciton var searchParams = new DbParams(new[] { new DbParam("id", model.ID, this.transformer.getParamType("id")), }); // adding timestamps this.beforeSave(model); var valueParams = this.transformer.getDbParams(model); valueParams.remove("created_at"); valueParams.add(new DbParam("updated_at", DateTime.Now.ToString(CultureInfo.InvariantCulture), SqlDbType.DateTime)); // updating DB.update(this.tableName, this.transformer.getDbParams(model), searchParams); var saved = this.one(model.ID); this.afterSave(model, saved); return(saved); }