public function save()
{
$this->_dsql()->owner->beginTransaction();
$this->hook('beforeSave');
// decide, insert or modify
if ($this->loaded()) {
$res = $this->modify();
} else {
$res = $this->insert();
}
$res->hook('afterSave');
$this->_dsql()->owner->commit();
return $res;
}