class ModelConverterUtils {

    static <T> void appendAuxiliaryData(Iterable<T> auxData, Collector<Row> collector, final int numFields) {
        if (auxData == null) {
            return;
        }

        final int numAdditionalFields = numFields - 2;
        int sliceIndex = 0;

        for (T data : auxData) {
            int stringIndex = Integer.MAX_VALUE;
            long modelId = getModelId(stringIndex, sliceIndex);
            Row row = new Row(numFields);
            row.setField(0, modelId);
            if (data instanceof Row) {
                Row r = (Row) data;
                for (int j = 0; j < numAdditionalFields; j++) {
                    row.setField(2 + j, r.getField(j));
                }
            } else {
                row.setField(2, data);
            }
            collector.collect(row);
            sliceIndex++;
        }
    }

}