private function processLocations(array $locations, ProgressBar $progressBar)
    {
        $contentList = $this->repository->sudo(
            function (Repository $repository) use ($locations) {
                $contentInfoList = array_map(
                    function (Location $location) {
                        return $location->contentInfo;
                    },
                    $locations
                );

                // load Content list in all languages
                return $repository->getContentService()->loadContentListByContentInfo(
                    $contentInfoList,
                    Language::ALL,
                    false
                );
            }
        );
        foreach ($locations as $location) {
            try {
                // ignore missing Content items
                if (!isset($contentList[$location->contentId])) {
                    continue;
                }

                $content = $contentList[$location->contentId];
                $this->repository->sudo(
                    function (Repository $repository) use ($location, $content) {
                        $repository->getURLAliasService()->refreshSystemUrlAliasesForLocation(
                            $location
                        );
                    }
                );
            } catch (Exception $e) {
                $contentInfo = $location->getContentInfo();
                $msg = sprintf(
                    'Failed processing location %d - [%d] %s (%s: %s)',
                    $location->id,
                    $contentInfo->id,
                    $contentInfo->name,
                    get_class($e),
                    $e->getMessage()
                );
                $this->logger->warning($msg);
                // in debug mode log full exception with a trace
                $this->logger->debug($e);
            } finally {
                $progressBar->advance(1);
            }
        }
    }