public RedmineAttachment refreshItem(RedmineAttachment journal) throws SQLException {
   return refreshItem(journal.getConnectionId(), journal);
 }
  public RedmineAttachment refreshItem(int connection_id, RedmineAttachment data)
      throws SQLException {
    if (data == null) return null;

    RedmineAttachment project = this.fetchById(connection_id, data.getAttachmentId());
    data.setConnectionId(connection_id);

    if (project.getId() == null) {
      this.insert(data);
    } else {
      data.setId(project.getId());

      if (project.getModified() == null) {
        project.setModified(new java.util.Date());
      }
      if (data.getModified() == null) {
        data.setModified(new java.util.Date());
      }
      if (!project.getModified().before(data.getModified())) {
        this.update(data);
      }
    }
    return data;
  }