docs: public void prepare(ResponseBuilder rb, ComponentFields mtasFields)
        throws IOException {
      // System.out.println(
      // "collection: " + System.nanoTime() + " - " +
      // Thread.currentThread().getId()
      // + " - " + rb.req.getParams().getBool("isShard", false) + " PREPARE "
      // + rb.stage + " " + rb.req.getParamString());
      Set<String> ids = MtasSolrResultUtil
          .getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_COLLECTION);
      if (!ids.isEmpty()) {
        int tmpCounter = 0;
        String[] keys = new String[ids.size()];
        String[] versions = new String[ids.size()];
        String[] actions = new String[ids.size()];
        String[] fields = new String[ids.size()];
        String[] collectionIds = new String[ids.size()];
        String[] posts = new String[ids.size()];
        String[] urls = new String[ids.size()];
        String[] collections = new String[ids.size()];
        for (String id : ids) {
          actions[tmpCounter] = rb.req.getParams().get(PARAM_MTAS_COLLECTION + "."
              + id + "." + NAME_MTAS_COLLECTION_ACTION, null);
          keys[tmpCounter] = rb.req.getParams().get(
              PARAM_MTAS_COLLECTION + "." + id + "." + NAME_MTAS_COLLECTION_KEY,
              String.valueOf(tmpCounter)).trim();
          versions[tmpCounter] = rb.req.getParams().get(
              PARAM_MTAS_COLLECTION + "." + id + "." + NAME_MTAS_COLLECTION_VERSION,
              null);
          fields[tmpCounter] = rb.req.getParams().get(
              PARAM_MTAS_COLLECTION + "." + id + "." + NAME_MTAS_COLLECTION_FIELD,
              null);
          collectionIds[tmpCounter] = rb.req.getParams().get(
              PARAM_MTAS_COLLECTION + "." + id + "." + NAME_MTAS_COLLECTION_ID,
              null);
          posts[tmpCounter] = rb.req.getParams().get(
              PARAM_MTAS_COLLECTION + "." + id + "." + NAME_MTAS_COLLECTION_POST,
              null);
          urls[tmpCounter] = rb.req.getParams().get(
              PARAM_MTAS_COLLECTION + "." + id + "." + NAME_MTAS_COLLECTION_URL,
              null);
          collections[tmpCounter] = rb.req.getParams().get(PARAM_MTAS_COLLECTION
              + "." + id + "." + NAME_MTAS_COLLECTION_COLLECTION, null);
          // always id for post
          if (actions[tmpCounter] != null && (actions[tmpCounter]
              .equals(ComponentCollection.ACTION_POST)
              || actions[tmpCounter].equals(ComponentCollection.ACTION_IMPORT)
              || actions[tmpCounter].equals(ComponentCollection.ACTION_CREATE))) {
            if (collectionIds[tmpCounter] == null
                || collectionIds[tmpCounter].isEmpty()) {
              collectionIds[tmpCounter] = UUID.randomUUID().toString();
              ModifiableSolrParams changedParams = new ModifiableSolrParams(
                  rb.req.getParams());
              changedParams.remove(PARAM_MTAS_COLLECTION + "." + id + "."
                  + NAME_MTAS_COLLECTION_ID);
              changedParams.set(PARAM_MTAS_COLLECTION + "." + id + "."
                  + NAME_MTAS_COLLECTION_ID, collectionIds[tmpCounter]);
              rb.req.setParams(changedParams);
            }
          }
          tmpCounter++;
        }
        mtasFields.doCollection = true;
        MtasSolrResultUtil.compareAndCheck(keys, actions,
            NAME_MTAS_COLLECTION_KEY, NAME_MTAS_COLLECTION_ACTION, true);
        MtasSolrResultUtil.compareAndCheck(keys, versions,
            NAME_MTAS_COLLECTION_KEY, NAME_MTAS_COLLECTION_VERSION, true);
        MtasSolrResultUtil.compareAndCheck(keys, fields, NAME_MTAS_COLLECTION_KEY,
            NAME_MTAS_COLLECTION_FIELD, false);
        MtasSolrResultUtil.compareAndCheck(keys, collectionIds,
            NAME_MTAS_COLLECTION_KEY, NAME_MTAS_COLLECTION_ID, false);
        MtasSolrResultUtil.compareAndCheck(keys, posts, NAME_MTAS_COLLECTION_KEY,
            NAME_MTAS_COLLECTION_POST, false);
        MtasSolrResultUtil.compareAndCheck(keys, urls, NAME_MTAS_COLLECTION_KEY,
            NAME_MTAS_COLLECTION_URL, false);
        MtasSolrResultUtil.compareAndCheck(keys, collections,
            NAME_MTAS_COLLECTION_KEY, NAME_MTAS_COLLECTION_COLLECTION, false);
        for (int i = 0; i < actions.length; i++) {
          if (actions[i] != null) {
            ComponentCollection componentCollection;
            switch (actions[i]) {
            case ComponentCollection.ACTION_LIST:
              componentCollection = new ComponentCollection(keys[i],
                  ComponentCollection.ACTION_LIST);
              componentCollection.setListVariables();
              mtasFields.collection.add(componentCollection);
              break;
            case ComponentCollection.ACTION_CHECK:
              if (collectionIds[i] != null) {
                componentCollection = new ComponentCollection(keys[i],
                    ComponentCollection.ACTION_CHECK);
                componentCollection.setCheckVariables(collectionIds[i]);
                mtasFields.collection.add(componentCollection);
              } else {
                throw new IOException(
                    "no id defined for collection (" + actions[i] + ")");
              }
              break;
            case ComponentCollection.ACTION_GET:
              if (collectionIds[i] != null) {
                componentCollection = new ComponentCollection(keys[i],
                    ComponentCollection.ACTION_GET);
                componentCollection.setGetVariables(collectionIds[i]);
                mtasFields.collection.add(componentCollection);
              } else {
                throw new IOException(
                    "no id defined for collection (" + actions[i] + ")");
              }
              break;
            case ComponentCollection.ACTION_CREATE:
              if (collectionIds[i] == null) {
                collectionIds[i] = UUID.randomUUID().toString();
              }
              if (fields[i] != null) {
                Set<String> fieldList = new HashSet<>(
                    Arrays.asList(fields[i].split(",")));
                componentCollection = new ComponentCollection(keys[i],
                    ComponentCollection.ACTION_CREATE);
                componentCollection.setCreateVariables(collectionIds[i],
                    fieldList);
                mtasFields.doCollection = true;
                mtasFields.collection.add(componentCollection);
                rb.setNeedDocSet(true);
              } else {
                throw new IOException(
                    "no field defined for collection (" + actions[i] + ")");
              }
              break;
            case ComponentCollection.ACTION_POST:
              if (posts[i] != null) {
                componentCollection = new ComponentCollection(keys[i],
                    ComponentCollection.ACTION_POST);
                componentCollection.setPostVariables(collectionIds[i],
                    stringToStringValues(posts[i]), versions[i]);
                mtasFields.collection.add(componentCollection);
              } else {
                throw new IOException(
                    "no post defined for collection (" + actions[i] + ")");
              }
              break;
            case ComponentCollection.ACTION_IMPORT:
              if (urls[i] != null && collections[i] != null) {
                componentCollection = new ComponentCollection(keys[i],
                    ComponentCollection.ACTION_IMPORT);
                componentCollection.setImportVariables(collectionIds[i], urls[i],
                    collections[i]);
                mtasFields.collection.add(componentCollection);
              } else {
                throw new IOException(
                    "no url or collection defined for collection (" + actions[i]
                        + ")");
              }
              break;
            case ComponentCollection.ACTION_DELETE:
              if (collectionIds[i] != null) {
                componentCollection = new ComponentCollection(keys[i],
                    ComponentCollection.ACTION_DELETE);
                componentCollection.setDeleteVariables(collectionIds[i]);
                mtasFields.collection.add(componentCollection);
              } else {
                throw new IOException(
                    "no id defined for collection (" + actions[i] + ")");
              }
              break;
            case ComponentCollection.ACTION_EMPTY:
              componentCollection = new ComponentCollection(keys[i],
                  ComponentCollection.ACTION_EMPTY);
              mtasFields.collection.add(componentCollection);
              break;
            default:
              throw new IOException(
                  "unrecognized action '" + actions[i] + "' for collection");
            }
          } else {
            throw new IOException("no action defined for collection");
          }
        }
      }
    }