private JSONArray serializeColumns(RegistryConfiguration conf) throws JSONException {
    List<RegistryConfiguration.Column> columns = conf.getColumns();
    JSONArray columnsJSON = new JSONArray();
    Iterator<RegistryConfiguration.Column> it = columns.iterator();
    while (it.hasNext()) {
      RegistryConfiguration.Column column = it.next();
      JSONObject columnJSON = new JSONObject();
      String field = column.getField();
      String subentity = column.getSubEntity();
      String foreignKey = column.getForeignKey();
      boolean isEditable = column.isEditable();
      boolean isVisible = column.isVisible();
      String type = column.getType();
      String format = column.getFormat();
      String color = column.getColor();
      String editorType = column.getEditorType();
      String summaryFunction = column.getSummaryFunction();
      String orderBy = column.getOrderBy();
      boolean infoColumn = column.isInfoColumn();
      String title = column.getTitle();
      String dependences = column.getDependences();
      String dependencesEntity = column.getDependencesEntity();

      columnJSON.put(FIELD, field);
      if (subentity != null) {
        columnJSON.put(SUBENTITY, subentity);
        columnJSON.put(FOREIGNKEY, foreignKey);
      }
      columnJSON.put(EDITABLE, isEditable);
      columnJSON.put(VISIBLE, isVisible);
      columnJSON.put(EDITOR_TYPE, editorType);
      columnJSON.put(FORMAT, format);
      columnJSON.put(COLOR, color);
      columnJSON.put(TYPE, type);
      columnJSON.put(SUMMARY_FUNCTION, summaryFunction);
      columnJSON.put(ORDER_BY, orderBy);
      columnJSON.put(INFO_COLUMN, infoColumn);
      columnJSON.put(TITLE, title);

      String mandatoryCol = column.getMandatoryColumn();
      if (mandatoryCol != null) {
        columnJSON.put(MANDATORY_COLUMN, mandatoryCol);
      }
      String mandatoryVal = column.getMandatoryValue();
      if (mandatoryVal != null) {
        columnJSON.put(MANDATORY_VALUE, mandatoryVal);
      }
      columnJSON.put(EDITOR_TYPE, editorType);
      columnJSON.put(DEPENDSFROM, dependences);
      columnJSON.put(DEPENDSFROM_ENTITY, dependencesEntity);
      columnsJSON.put(columnJSON);
    }
    return columnsJSON;
  }