private function getParentLocation(ParameterCollectionInterface $parameterCollection): ?Location
    {
        if ($parameterCollection->getParameter('use_current_location')->getValue() === true) {
            return $this->contentProvider->provideLocation();
        }

        $parentLocationId = $parameterCollection->getParameter('parent_location_id')->getValue();
        if ($parentLocationId === null) {
            return null;
        }

        try {
            $parentLocation = $this->locationService->loadLocation($parentLocationId);

            return $parentLocation->invisible ? null : $parentLocation;
        } catch (Throwable $t) {
            return null;
        }
    }