protected function registerInstance($key, $name, $interface)
    {
        if (is_a($name, $interface, true)) {
            $instances = $this->getOption($key);
            if ($instances === null || array_search($name, $instances) === false) {
                $instances[] = $name;
                $this->setOption($key, $instances);
                $this->registerMetadataService();
            }
        }
    }