public function copySubtree($fromLocationID, $toLocationID, $name = false)
    {
        $this->repository->setCurrentUser($this->repository->getUserService()->loadUser($this->adminID));

        /** @var $locationService LocationService */
        $locationService = $this->repository->getLocationService();
        /** @var ContentService $contentService */
        $contentService = $this->repository->getContentService();

        try {
            $fromLocation = $locationService->loadLocation($fromLocationID);
            $toLocation = $locationService->loadLocation($toLocationID);

            $newLocation = $locationService->copySubtree($fromLocation, $toLocation);

            if ($name) {
                $contentInfo = $newLocation->getContentInfo();
                $contentDraft = $contentService->createContentDraft($contentInfo);
                $contentUpdateStruct = $contentService->newContentUpdateStruct();

                $fields = $contentDraft->fields;
                foreach ($fields as $key => $field) {
                    switch ($key) {
                        case 'title':
                            $contentUpdateStruct->setField('title', $name);
                            break;
                        case 'activated':
                            $contentUpdateStruct->setField('activated', new Value(false));
                            break;
                        default:
                            break;
                    }
                }

                $contentUpdateStruct->initialLanguageCode = $contentInfo->mainLanguageCode;
                $contentDraft = $contentService->updateContent($contentDraft->versionInfo, $contentUpdateStruct);
                $contentService->publishVersion($contentDraft->versionInfo);
            }

            return $newLocation->getContentInfo()->mainLocationId;
        } catch (UnauthorizedException $e) {
            throw new \RuntimeException($e->getMessage());
        } catch (NotFoundException $e) {
            throw new \RuntimeException($e->getMessage());
        } catch (InvalidArgumentException $e) {
            throw new \RuntimeException($e->getMessage());
        } catch (BadStateException $e) {
            throw new \RuntimeException($e->getMessage());
        } catch (ContentFieldValidationException $e) {
            throw new \RuntimeException($e->getMessage());
        } catch (ContentValidationException $e) {
            throw new \RuntimeException($e->getMessage());
        }
    }