original_string: public function save(Model $model, $options = array())
      {
          $options = array_merge(array(
              'filter' => true,
              'observer' => true,
          ), $options);
  
          if ($options['filter']) {
              $this->filter($model);
          }
  
          if ($options['observer']) {
              $this->applyHook('saving', $model, $options);
          }
  
          $modified = $this->connection->persist($this, $model->dump());
          $model->setId($modified['$id']);
  
          if ($options['observer']) {
              $this->applyHook('saved', $model, $options);
          }
  
          $model->sync($modified);
          $this->resetCache();
      }
code: public function save(Model $model, $options = array())
      {
          $options = array_merge(array(
              'filter' => true,
              'observer' => true,
          ), $options);
  
          if ($options['filter']) {
              $this->filter($model);
          }
  
          if ($options['observer']) {
              $this->applyHook('saving', $model, $options);
          }
  
          $modified = $this->connection->persist($this, $model->dump());
          $model->setId($modified['$id']);
  
          if ($options['observer']) {
              $this->applyHook('saved', $model, $options);
          }
  
          $model->sync($modified);
          $this->resetCache();
      }
code_tokens: public function save ( Model $ model , $ options = array ( ) ) { $ options = array_merge ( array ( 'filter' => true , 'observer' => true , ) , $ options ) ; if ( $ options [ 'filter' ] ) { $ this -> filter ( $ model ) ; } if ( $ options [ 'observer' ] ) { $ this -> applyHook ( 'saving' , $ model , $ options ) ; } $ modified = $ this -> connection -> persist ( $ this , $ model -> dump ( ) ) ; $ model -> setId ( $ modified [ '$id' ] ) ; if ( $ options [ 'observer' ] ) { $ this -> applyHook ( 'saved' , $ model , $ options ) ; } $ model -> sync ( $ modified ) ; $ this -> resetCache ( ) ; }
docstring: Save model to persistent state
  
  @param \Norm\Model $model
  @param array       $options
  
  @return void
docstring_tokens: Save model to persistent state