public function configureEventManager(SharedEventManagerInterface $eventManager, $id, $eventName)
    {
        $quotedId = $this->xpathQuote($id);
        $quotedEvent = $this->xpathQuote($eventName);
        $objectManager = $this->getObjectManager();

        $this->addListenersFromArray($eventManager, $id, $eventName);

        $xpath = "./listener[@scope = $quotedId and @event = $quotedEvent and @class != '']";
        foreach ($this->getXml()->xpath($xpath) as $node) {
            $class = (string)$node['class'];
            $priority = (string)$node['priority'];

            if (!$objectManager->has($class)) {
                continue;
            }

            $params = array();
            if (isset($node->options)) {
                $params = $node->options->toPhpValue('array', $objectManager);
            }

            $listener = $objectManager->newInstance($class, $params);
            $eventManager->attach($id, $eventName, $listener, (int)$priority);
        }

        return $this;
    }