private Invoice createInvoiceObjectFromResponse(HttpResponse response) throws IOException, JSONException {
		BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
		
		StringBuilder content = new StringBuilder();
		String line;
		
		while (null != (line = rd.readLine())) {
		    content.append(line);
		}
		
		Object obj=JSONValue.parse(content.toString());
		JSONObject finalResult = (JSONObject)obj;
		
		if(finalResult.get("error") != null ){
			System.out.println("Error: " + finalResult.get("error"));
		}
		
		return new Invoice(finalResult);
	};