@Override
	public <E extends ApiResponse> E execute(ApiRequest request, AbstractContentHandler contentHandler, Class<E> clazz) throws ApiException {
		ApiConnector connector = getConnector();
		URL url = connector.getURL(request);
		Map<String, String> params = connector.getParams(request);
		InputStream inputStream = connector.getInputStream(url, params);
		String outputFileName = request.getPage().getPage() + "-" + new Date().getTime() + ".xml";
		File outputFile = new File(destinationDirectory, outputFileName);
		FileOutputStream outputStream = null;
		try {
			outputStream = new FileOutputStream(outputFile);
			inputStream = new InputStreamSplitter(inputStream, outputStream);
		} catch (FileNotFoundException e) {
			logger.error("Could not write response xml to file: ", e);
		}
		E response = getApiResponse(contentHandler, inputStream, clazz);
		if (outputStream != null) {
			try {
				outputStream.flush();
				outputStream.close();
			} catch (IOException e) {
				logger.error("Could not flush/close response xml file: ", e);
			}
		}
		return response;
	}