private void encodeTimestamp(String id, Date date, List<ModificationItem> mods) {
    String str;

    if (date != null) {
      str = LdapFormats.formatGeneralizedTime(date);
      encodeObject(id, str, mods);
    } else {
      encodeObject(id, null, mods);
    }
  }
  private void encodeTimestamps(String name, List<Date> dates, List<ModificationItem> mods) {
    Attribute attr;
    String str;
    boolean empty = true;

    attr = new BasicAttribute(name);
    if (dates != null) {
      for (Date o : dates) {
        if (empty) empty = false;
        str = LdapFormats.formatGeneralizedTime(o);
        attr.add(str);
      }
    }
    mods.add(new ModificationItem(DirContext.REPLACE_ATTRIBUTE, attr));
  }