docs: public Map<String, EntityDocument> wbGetEntities(String ids, String sites,
  			String titles, String props, String languages, String sitefilter)
  			throws MediaWikiApiErrorException, IOException {
  
  		Map<String, String> parameters = new HashMap<String, String>();
  		parameters.put(ApiConnection.PARAM_ACTION, "wbgetentities");
  
  		if (ids != null) {
  			parameters.put("ids", ids);
  			if (titles != null || sites != null) {
  				throw new IllegalArgumentException(
  						"Cannot use parameters \"sites\" or \"titles\" when using ids to get entity data");
  			}
  		} else if (titles != null) {
  			parameters.put("titles", titles);
  			if (sites == null) {
  				throw new IllegalArgumentException(
  						"Sites parameter is required when using titles parameter to get entity data.");
  			}
  			parameters.put("sites", sites);
  		} else {
  			throw new IllegalArgumentException(
  					"Either ids, or titles and site must be specified for this action.");
  		}
  
  		if (props != null) {
  			parameters.put("props", props);
  		}
  
  		if (languages != null) {
  			parameters.put("languages", languages);
  		}
  		if (sitefilter != null) {
  			parameters.put("sitefilter", sitefilter);
  		}
  
  		Map<String, EntityDocument> result = new HashMap<String, EntityDocument>();
  
  		try {
  			JsonNode root = this.connection.sendJsonRequest("POST", parameters);
  
  			JsonNode entities = root.path("entities");
  			Iterator<Entry<String,JsonNode>> entitiesIterator = entities.fields();
  			while(entitiesIterator.hasNext()) {
  				Entry<String,JsonNode> entry = entitiesIterator.next();
  				JsonNode entityNode = entry.getValue();
  				if (!entityNode.has("missing")) {
  					try {
  						EntityDocument ed = mapper.treeToValue(entityNode, EntityDocumentImpl.class);
  
  						if (titles == null) {
  							// We use the JSON key rather than the id of the value
  							// so that retrieving redirected entities works.
  							result.put(entry.getKey(), ed);
  						} else {
  							if (ed instanceof ItemDocumentImpl
  									&& ((ItemDocumentImpl) ed)
  											.getSiteLinks().containsKey(sites)) {
  								result.put(((ItemDocumentImpl) ed)
  										.getSiteLinks().get(sites)
  										.getPageTitle(), ed);
  							}
  						}
  					} catch (JsonProcessingException e) {
  						logger.error("Error when reading JSON for entity "
  								+ entityNode.path("id").asText("UNKNOWN")
  								+ ": " + e.toString());
  					}
  				}
  			}
  		} catch (IOException e) {
  			logger.error("Could not retrive data: " + e.toString());
  			throw e;
  		}
  
  		return result;
  	}