private function groupPackagesByName(array $packages): array
    {
        $groupedPackages = [];
        foreach ($packages as $package) {
            $groupedPackages[$package->getName()][] = $package;
        }

        return $groupedPackages;
    }