public function addPagePartsToPage($nodeOrInternalName, array $structure, $language)
    {
        $node = $this->getNode($nodeOrInternalName);

        // First instantiate all PageParts. This way no PageParts will be saved if there is an issue instantiating some of them.
        $instantiatedPageParts = array();
        foreach ($structure as $context => $pageParts) {
            $instantiatedPageParts[$context] = array();

            foreach ($pageParts as $pagePartOrFunction) {
                if (is_callable($pagePartOrFunction)) {
                    $pagePartOrFunction = $pagePartOrFunction();

                    if (!isset($pagePartOrFunction) || (is_null($pagePartOrFunction))) {
                        throw new \LogicException('A function returned nothing for a pagepart. Make sure you return your instantiated pageparts in your anonymous functions.');
                    }
                }
                if (!$pagePartOrFunction instanceof PagePartInterface) {
                    throw new \LogicException('Detected a supposed pagepart that did not implement the PagePartInterface.');
                }

                $instantiatedPageParts[$context][] = $pagePartOrFunction;
            }
        }

        // All good. We can start saving.
        foreach ($instantiatedPageParts as $context => $pageParts) {
            foreach ($pageParts as $pagePart) {
                $this->addPagePartToPage($node, $pagePart, $language, $context);
            }
        }
    }