private void collectCountFromImexService(
      ServiceType service,
      String query,
      PsicquicCountResults results,
      PsicquicSimpleClient client) {
    final String imexQuery = createImexQuery(query);
    results.setImex(true);

    try {

      long count = client.countByQuery(imexQuery);

      results.setImexCount((int) count);
      results.setImexResponding(true);

    } catch (IOException e) {
      log.error(
          "Problem connecting to PSICQUIC service '"
              + service.getName()
              + "': / proxy "
              + intactViewConfiguration.getProxyHost()
              + ":"
              + intactViewConfiguration.getProxyPort(),
          e);

      results.setImexResponding(false);
    }
  }
  private PsicquicCountResults processPsicquicQueries(
      ServiceType service, String query, PsicquicSimpleClient client) {
    PsicquicCountResults results = new PsicquicCountResults();

    if (isImexService(service)) {
      results.setImex(true);
      collectCountFromImexService(service, query, results, client);
    }

    collectCountFromPsicquicService(service, query, results, client);

    return results;
  }