public ESModelElementQuery modelelementQuery(
      ESPrimaryVersionSpec source,
      List<ESModelElementId> modelElements,
      int upper,
      int lower,
      boolean allVersions,
      boolean includeChangePackages) {

    // TODO: provide util method for mapping to internal classes
    List<ModelElementId> modelElementIds = new ArrayList<ModelElementId>();
    for (ESModelElementId id : modelElements) {
      modelElementIds.add(((ESModelElementIdImpl) id).getInternalAPIImpl());
    }

    PrimaryVersionSpec sourcePrimaryVersionSpec =
        ((ESPrimaryVersionSpecImpl) source).getInternalAPIImpl();

    ModelElementQuery modelelementQuery =
        HistoryQueryBuilder.modelelementQuery(
            sourcePrimaryVersionSpec,
            modelElementIds,
            upper,
            lower,
            allVersions,
            includeChangePackages);

    ESModelElementQueryImpl apiImpl = modelelementQuery.getAPIImpl();
    return apiImpl;
  }
 public ESModelElementQuery modelelementQuery(
     ESPrimaryVersionSpec source,
     ESModelElementId id,
     int upper,
     int lower,
     boolean allVersions,
     boolean includeCp) {
   ModelElementQuery modelelementQuery =
       HistoryQueryBuilder.modelelementQuery(
           ((ESPrimaryVersionSpecImpl) source).getInternalAPIImpl(),
           ((ESModelElementIdImpl) id).getInternalAPIImpl(),
           upper,
           lower,
           allVersions,
           includeCp);
   return modelelementQuery.getAPIImpl();
 }