private static Collection<ScatterGatherBuilder.KVRequestInfo<Long, UpdateStatus>>
      buildScatterGatherDeleteRequests(
          ScatterGatherBuilder<Greeting> sg,
          Long[] ids,
          RootBuilderWrapper<Long, Greeting> builders)
          throws ServiceUnavailableException {
    @SuppressWarnings("unchecked")
    BatchDeleteRequest<Long, Greeting> request =
        (BatchDeleteRequest<Long, Greeting>)
            builders.batchDelete().ids(ids).setParam("foo", "bar").build();

    return sg.buildRequests(request, new RequestContext()).getRequestInfo();
  }
  private static Collection<ScatterGatherBuilder.RequestInfo<Greeting>>
      buildScatterGatherGetRequests(ScatterGatherBuilder<Greeting> sg, Long[] ids)
          throws ServiceUnavailableException {
    Request<BatchResponse<Greeting>> request =
        new GreetingsBuilders()
            .batchGet()
            .ids(ids)
            .fields(Greeting.fields().message())
            .setParam("foo", "bar")
            .build();

    return sg.buildRequestsV2((BatchGetRequest<Greeting>) request, new RequestContext())
        .getRequestInfo();
  }