// -----------database helper functions--------------
 public static String implodeValues(InvoiceTemplate item, boolean withId) {
   ArrayList<String> values = item.implodeFieldValuesHelper(withId);
   String output = "";
   for (String value : values) {
     if (!output.isEmpty()) output += ",";
     output += "'" + value + "'";
   }
   return output;
 }
  public static String implodeFieldsWithValues(InvoiceTemplate item, boolean withId) {
    ArrayList<String> values =
        item.implodeFieldValuesHelper(
            true); // get entire list of values; whether the id is included will be dealt with
                   // later.

    if (values.size() != fields.length) {
      System.err.println(
          "InvoiceTemplate:implodeFieldsWithValues(): ERROR: values length does not match fields length");
    }

    String output = "";
    for (int i = 0; i < fields.length; i++) {
      if (!withId && fields[i].contentEquals("id")) continue;
      if (!output.isEmpty()) output += ",";
      output += fields[i] + "='" + values.get(i) + "'";
    }
    return output;
  }