public RankImage createRankImage() {
    RankImage image = new RankImageImpl();
    image.setUuid(getNextUuid());
    image.setCreated(new Date());
    image.setCreatedBy(getCurrentUser());
    image.setModified(new Date());
    image.setModifiedBy(getCurrentUser());

    LOG.info("createRankImage:  Rank Image  " + image.getUuid() + " created successfully");
    return image;
  }
  public RankImage createRankImageAttachmentObject(String attachId, String name) {
    if (!isRanksEnabled()) {
      LOG.warn("createRankImageAttachmentObject invoked, but ranks are disabled");
      return null;
    }
    try {
      RankImage attach = new RankImageImpl();
      attach.setCreated(new Date());
      attach.setModified(new Date());

      ContentResource cr = contentHostingService.getResource(attachId);

      User creator =
          userDirectoryService.getUser(
              cr.getProperties().getProperty(cr.getProperties().getNamePropCreator()));
      attach.setCreatedBy(creator.getDisplayName());
      User modifier =
          userDirectoryService.getUser(
              cr.getProperties().getProperty(cr.getProperties().getNamePropModifiedBy()));
      attach.setModifiedBy(modifier.getDisplayName());

      attach.setAttachmentSize((Long.valueOf(cr.getContentLength())).toString());
      attach.setAttachmentId(attachId);
      attach.setAttachmentName(name);
      attach.setAttachmentType(cr.getContentType());
      String tempString = cr.getUrl();
      attach.setAttachmentUrl(resourceUrlEscaping(tempString));

      getHibernateTemplate().saveOrUpdate(attach);

      return attach;
    } catch (Exception e) {
      e.printStackTrace();
      return null;
    }
  }