public function save($new_key = null)
    {
        $return = true;

        $cn = $this->device->getConnection(\Octris\Db::DB_MASTER);
        $cl = $cn->getCollection($this->collection);

        if (is_null($this->_id) || (!is_null($new_key) && $this->_id !== $new_key)) {
            // insert new object
            if (($return = !!($new_key = $cl->insert($this, $new_key)))) {
                $this->_id = $new_key;
            }
        } else {
            // update object
            $return = $cl->update($this, $this->_id);
        }

        $cn->release();

        return $return;
    }