protected function loadMetadataFor($value)
    {
        $definitions = $this->getDefinitions();

        foreach ($definitions as $name => $options) {
            if ($value == $options['type']) {
                $definition = $options;

                break;
            }
        }

        if (!isset($definition)) {
            throw new NoSuchMetadataException(sprintf('No metadata found for module type "%s".', $value));
        }

        // Build route collection
        $collection = new RouteCollection;

        foreach ($definition['routing'] as $resource) {
            $resourceType = isset($resource['type']) ? $resource['type'] : null;

            $subCollection = $this->routingLoader->load($resource['resource'], $resourceType);

            $collection->addCollection($subCollection);
        }

        // Build metadata
        $metadata = new ModuleMetadata($definition['name'], $definition['type'], $collection);

        return $this->collection[$definition['type']] = $metadata;
    }