protected function _addOptions()
    {
        if (!empty($this->_plugin['composer']['extra']['options'])) {
            $this->loadModel('System.Options');
            foreach ($this->_plugin['composer']['extra']['options'] as $index => $option) {
                if (empty($option['name'])) {
                    $this->err(__d('installer', 'Unable to register {0} option, invalid option #{1}.', ($this->_plugin['type'] == 'plugin' ? __d('installer', 'plugin') : __d('installer', 'theme')), $index));

                    return false;
                }

                $entity = $this->Options->newEntity([
                    'name' => $option['name'],
                    'value' => !empty($option['value']) ? $option['value'] : null,
                    'autoload' => isset($option['autoload']) ? (bool)$option['autoload'] : false,
                ]);
                $errors = $entity->errors();

                if (empty($errors)) {
                    if (!$this->Options->save($entity)) {
                        $this->err(__d('installer', 'Unable to register option "{0}".', [$option['name']]));

                        return false;
                    }
                    $this->_addedOptions[] = $option['name'];
                } else {
                    $this->err(__d('installer', 'Some errors were found while trying to register {0} options values, see below:', ($this->_plugin['type'] == 'plugin' ? __d('installer', 'plugin') : __d('installer', 'theme'))));
                    foreach ($errors as $error) {
                        $this->err(__d('installer', '  - {0}', [$error]));
                    }

                    return false;
                }
            }
        }

        return true;
    }