public Data runTask(API task, Data object, String session) {
        String requestString = json.toJson(new Arrival(session, task.toString(), object));
        if (requestString == null) {
            log.error(TAG, "Failed to convert to JSON! Aborting.");
            return new Error(Error.Type.CAST, "JSON cast failed!");
        }

        try

        {
            HttpClient httpclient = HttpClients.createDefault();
            // create post with URL
            HttpPost httppost = new HttpPost(URL);
            // add json string
            httppost.setEntity(new StringEntity(requestString));
            //Execute and get the response.
            HttpResponse response = httpclient.execute(httppost);
            HttpEntity responseEntity = response.getEntity();
            // todo should i do this?
            // httppost.releaseConnection();

            // read response
            BufferedReader in = new BufferedReader(new InputStreamReader(responseEntity.getContent()));
            StringBuffer sb = new StringBuffer("");
            String line = "";
            while ((line = in.readLine()) != null) {
                sb.append(line);
            }
            in.close();
            String result = sb.toString();

            // Convert Response from json, Should be a Departure Object
            Data responseData = json.fromJson(result);
            if (!(responseData instanceof Departure)) {
                return new Error(Error.Type.SERVER, "Server returned invalid response!");
            }
            return ((Departure) responseData).getObject();
        } catch (
                ClientProtocolException e
                )

        {
            log.error(TAG, "Protocol exception!");
            e.printStackTrace();
        } catch (
                UnsupportedEncodingException e
                )

        {
            log.error(TAG, "Encoding exception!");
            e.printStackTrace();
        } catch (
                IOException e
                )

        {
            log.error(TAG, "Failed request! Check your URL!");
            e.printStackTrace();
        }

        return new

                Error(Error.Type.CONNECTION, "Connection to server failed!");
    }