@Override
  public boolean checkIfVersionAvailableForPackage(Package _package, Update update) {
    logger.debug(
        "Attempting to check version availability for Update: "
            + update
            + ", for Package: "
            + _package);

    boolean versionAvailable =
        getSession()
            .createCriteria(Update.class)
            .add(Restrictions.eq("thePackage", _package))
            .add(Restrictions.eq("major", update.getMajor()))
            .add(Restrictions.eq("minor", update.getMinor()))
            .add(Restrictions.eq("release", update.getRelease()))
            .add(Restrictions.eq("nightly", update.getNightly()))
            .add(Restrictions.eq("developmentVersion", update.isDevelopmentVersion()))
            .list()
            .isEmpty();

    logger.debug(
        "Found version availability for Update: "
            + update
            + ", for Package: "
            + _package
            + ": "
            + versionAvailable);
    return versionAvailable;
  }
 @Override
 public void persist(Update update) throws IOException {
   logger.debug("Attempting to persist Update: " + update);
   update.setFileData(fileService.saveMultipartFile(update.getFile()));
   update.setFileName(update.getFile().getOriginalFilename());
   update.setFileSize(update.getFile().getSize());
   getSession().persist(update);
   logger.debug("Persisted Update: " + update);
 }
 @Override
 public void remove(Update update) {
   logger.debug("Attempting to persist Update: " + update);
   String fileData = update.getFileData();
   getSession().delete(update);
   fileService.removeFile(fileData);
   logger.debug("Deleted Update: " + update);
 }