protected void copyOrRemoveSnapshot(
      String packageName, String snapshotName, boolean delete, String newSnapshotName)
      throws SerializationException {

    if (delete) {
      log.info(
          "USER:"******" REMOVING SNAPSHOT for package: ["
              + packageName
              + "] snapshot: ["
              + snapshotName
              + "]");
      rulesRepository.removePackageSnapshot(packageName, snapshotName);
    } else {
      if (newSnapshotName.equals("")) {
        throw new SerializationException("Need to have a new snapshot name.");
      }
      log.info(
          "USER:"******" COPYING SNAPSHOT for package: ["
              + packageName
              + "] snapshot: ["
              + snapshotName
              + "] to ["
              + newSnapshotName
              + "]");

      rulesRepository.copyPackageSnapshot(packageName, snapshotName, newSnapshotName);
    }
  }
  protected void createPackageSnapshot(
      String packageName, String snapshotName, boolean replaceExisting, String comment) {

    log.info(
        "USER:"******" CREATING PACKAGE SNAPSHOT for package: ["
            + packageName
            + "] snapshot name: ["
            + snapshotName);

    if (replaceExisting) {
      rulesRepository.removePackageSnapshot(packageName, snapshotName);
    }

    rulesRepository.createPackageSnapshot(packageName, snapshotName);
    PackageItem item = rulesRepository.loadPackageSnapshot(packageName, snapshotName);
    item.updateCheckinComment(comment);
    rulesRepository.save();
  }