FieldSet parseFieldCollection(DocumentTypeManager docMan, String docType, String fieldNames) {
        DocumentType type = docMan.getDocumentType(docType);
        if (type == null) {
            throw new IllegalArgumentException("Unknown document type " + docType);
        }

        FieldCollection collection = new FieldCollection(type);
        if (fieldNames.equals("[document]")) {
            collection.addAll(type.fieldSet());
        }
        else {
            StringTokenizer tokenizer = new StringTokenizer(fieldNames, ",");
            while (tokenizer.hasMoreTokens()) {
                String token = tokenizer.nextToken();
                Field f = type.getField(token);
                if (f == null) {
                    throw new IllegalArgumentException("No such field " + token);
                }
                collection.add(f);
            }
        }
        return collection;
    }
TODO: Move to document and implement
document/src/main/java/com/yahoo/document/fieldset/FieldSetRepo.java