protected function _onSaveSuccess($entity, $options)
    {
        $success = $this->_associations->saveChildren(
            $this,
            $entity,
            $options['associated'],
            ['_primary' => false] + $options->getArrayCopy()
        );

        if (!$success && $options['atomic']) {
            return false;
        }

        $this->dispatchEvent('Model.afterSave', compact('entity', 'options'));

        if ($options['atomic'] && !$this->getConnection()->inTransaction()) {
            throw new RolledbackTransactionException(['table' => get_class($this)]);
        }

        if (!$options['atomic'] && !$options['_primary']) {
            $entity->clean();
            $entity->isNew(false);
            $entity->setSource($this->getRegistryAlias());
        }

        return true;
    }