protected function _saveRelatedObject(& $obj, $fkMeta) {
        $saved= false;
        $local= $fkMeta['local'];
        $foreign= $fkMeta['foreign'];
        $cardinality= $fkMeta['cardinality'];
        $owner= isset ($fkMeta['owner']) ? $fkMeta['owner'] : '';
        if (!$owner) {
            $owner= $cardinality === 'many' ? 'foreign' : 'local';
        }
        $criteria = isset($fkMeta['criteria']) ? $fkMeta['criteria'] : null;
        if ($owner === 'local' && $fk= $this->get($local)) {
            $obj->set($foreign, $fk);
            if (isset($criteria['foreign']) && is_array($criteria['foreign'])) {
                foreach ($criteria['foreign'] as $critKey => $critVal) {
                    if (is_numeric($critKey)) continue;
                    $obj->set($critKey, $critVal);
                }
            }
            $saved= $obj->save();
        } elseif ($owner === 'foreign') {
            if ($obj->isNew() || !empty($obj->_dirty)) {
                $saved= $obj->save();
            }
            $fk= $obj->get($foreign);
            if ($fk) {
                $this->set($local, $fk);
                if (isset($criteria['local']) && is_array($criteria['local'])) {
                    foreach ($criteria['local'] as $critKey => $critVal) {
                        if (is_numeric($critKey)) continue;
                        $this->set($critKey, $critVal);
                    }
                }
            }
        }
        if ($this->xpdo->getDebug() === true) $this->xpdo->log(xPDO::LOG_LEVEL_DEBUG , ($saved ? 'Successfully saved' : 'Could not save') . " related object\nMain object: " . print_r($this->toArray('', true), true) . "\nRelated Object: " . print_r($obj->toArray('', true), true));
        return $saved;
    }