private function renameNonRootPackage(Package $package, $newName)
 {
     $previousInstallInfo = $package->getInstallInfo();
     $installInfo = new InstallInfo($newName, $previousInstallInfo->getInstallPath());
     $installInfo->setInstallerName($previousInstallInfo->getInstallerName());
     foreach ($previousInstallInfo->getEnabledBindingUuids() as $uuid) {
         $installInfo->addEnabledBindingUuid($uuid);
     }
     foreach ($previousInstallInfo->getDisabledBindingUuids() as $uuid) {
         $installInfo->addDisabledBindingUuid($uuid);
     }
     $this->rootPackageFile->removeInstallInfo($package->getName());
     $this->rootPackageFile->addInstallInfo($installInfo);
     try {
         $this->packageFileStorage->saveRootPackageFile($this->rootPackageFile);
     } catch (Exception $e) {
         $this->rootPackageFile->removeInstallInfo($newName);
         $this->rootPackageFile->addInstallInfo($previousInstallInfo);
         throw $e;
     }
     $this->packages->remove($package->getName());
     $this->packages->add(new Package($package->getPackageFile(), $package->getInstallPath(), $installInfo, $package->getLoadErrors()));
 }