private function buildPath(LocationInterface $location): array
    {
        $path = [];

        while (true) {
            $path[] = [
                'id' => $location->getLocationId(),
                'name' => $location->getName(),
            ];

            if ($location->getParentId() === null) {
                break;
            }

            try {
                $location = $this->backend->loadLocation($location->getParentId());
            } catch (NotFoundException $e) {
                break;
            }
        }

        return array_reverse($path);
    }