private function getBodyElement(\DOMDocument $document)
    {
        $bodyElement = $document->getElementsByTagName('body')->item(0);
        if ($bodyElement === null) {
            throw new \BadMethodCallException(
                'getBodyElement method may only be called after ensureExistenceOfBodyElement has been called.',
                1508173775427
            );
        }

        return $bodyElement;
    }