/**
  * undocumented function
  *
  * @param string $target 
  * @param string $copy_left_from 
  * @param string $left_offset 
  * @param string $level_offset 
  * @return void
  * @author Andy Bennett
  */
 protected function insert($target, $copy_left_from, $left_offset, $level_offset)
 {
     $db = new Database();
     $obj_id = $db->select($this->parent_model . '_' . $this->primary_key)->from($this->table_name)->where('id', $target)->get()->current()->{$this->parent_model . '_' . $this->primary_key};
     versions_helper::version_position_table($this->table_name, $this->version);
     $target_id = $db->select($this->primary_key)->from($this->table_name)->where($this->parent_model . '_' . $this->primary_key, $obj_id)->get()->current()->{$this->primary_key};
     return parent::insert($target_id, $copy_left_from, $left_offset, $level_offset);
 }
 /**
  * undocumented function
  *
  * @param string $target 
  * @param string $copy_left_from 
  * @param string $left_offset 
  * @param string $level_offset 
  * @return void
  * @author Andy Bennett
  */
 protected function insert($target, $copy_left_from, $left_offset, $level_offset)
 {
     versions_helper::version_position_table($this->table_name, $this->version);
     $w = $this->foreign_key($this->parent_model);
     $target = ORM::factory($this->object_name)->where($w, $target)->find();
     if (!$target->loaded) {
         throw new Exception("Cannot load target", 1);
     }
     return parent::insert($target, $copy_left_from, $left_offset, $level_offset);
 }