protected function loadMetadata($class)
    {
        // first run, we have no parent
        $parent = null;

        $parentClasses = $this->getParentClasses($class);
        $parentClasses[] = $class;

        // iterate through the list of mapped service parent classes
        foreach ($parentClasses as $parentClass) {
            // create an empty metadata class
            $class = new ServiceMetadata($class);

            // copy all data from the immediate parent, if present
            if ($parent) {
                $class->setClassName($parent->getClassName());
                $class->setAllListeners($parent->getAllListeners());
            }

            // now overlay the metadata from the class itself
            if (!isset($this->loadedMetadata[$parentClass])) {
                $this->driver->loadMetadataForClass($parentClass, $class);
                $this->loadedMetadata[$parentClass] = $class;
            }

            // the parent for the next iteration will be this iteration
            $parent = $class;
        }
    }