/**
  * read in a resource and update it
  *
  * @param int $id            
  * @return multitype:string
  */
 public function put($id)
 {
     $request = $this->getDI()->get('request');
     // load up the expected object based on the controller name
     $put = $request->getJson($this->getControllerName('singular'));
     // filter out any block columns from the posted data
     $blockFields = $this->model->getBlockColumns();
     foreach ($blockFields as $key => $value) {
         unset($put->{$value});
     }
     if (!$put) {
         throw new HTTPException("There was an error updating an existing record.", 500, array('dev' => "Invalid data posted to the server", 'code' => '568136818916816'));
     }
     $put = $this->beforeSave($put, $id);
     $id = $this->entity->save($put, $id);
     $this->afterSave($put, $id);
     // reload record so we can return it
     $search_result = $this->entity->findFirst($id);
     if ($search_result == false) {
         // This is bad. Throw a 500. Responses should always be objects.
         throw new HTTPException("Could not find newly updated record.", 500, array('dev' => 'The resource you requested is not available.', 'code' => '6816168161681'));
     } else {
         return $this->respond($search_result);
     }
 }