private function renameRootPackage(RootPackage $package, $newName)
 {
     $packageFile = $package->getPackageFile();
     $previousName = $packageFile->getPackageName();
     $packageFile->setPackageName($newName);
     try {
         $this->packageFileStorage->saveRootPackageFile($this->rootPackageFile);
     } catch (Exception $e) {
         $packageFile->setPackageName($previousName);
         throw $e;
     }
     $this->packages->remove($package->getName());
     $this->packages->add(new RootPackage($packageFile, $package->getInstallPath()));
 }