protected function publishAliases($locationId, $parentLocationId, $contentId)
    {
        $content = $this->contentService->loadContent($contentId);

        $urlAliasNames = $this->nameSchemaResolver->resolveUrlAliasSchema($content);

        foreach ($urlAliasNames as $languageCode => $name) {
            try {
                $this->setMigrationTable();
                $this->urlAliasHandler->publishUrlAliasForLocation(
                    $locationId,
                    $parentLocationId,
                    $name,
                    $languageCode,
                    $content->contentInfo->alwaysAvailable
                );
                $this->setDefaultTable();
            } catch (Exception $e) {
                $this->setDefaultTable();
                throw $e;
            }
        }

        return count($urlAliasNames);
    }