public function getChildOfType($type)
    {
        $children = $this->getChildrenOfType($type);

        if (!$children) {
            throw new OutOfBoundsException(sprintf(
                'Expected exactly one child of type "%s", got "%s"',
                $type, count($children)
            ));
        }

        if (count($children) > 1) {
            throw new OutOfBoundsException(sprintf(
                'More than one node of type "%s" but getChildOfType will only ever return one.',
                $type
            ));
        }

        return current($children);
    }