private static HttpUriRequest prepareRequest(String address, Request request) {
        HttpUriRequest httpRequest;
        if (request.getType() == Request.RequestType.PUT) {
            HttpPut hp = new HttpPut(address);
            ByteArrayEntity bae = new ByteArrayEntity(SerializationStuff.getBytes(request.getData()));
            hp.setEntity(bae);
            httpRequest = hp;
        } else if (request.getType() == Request.RequestType.GET) {
            httpRequest = new HttpGet(address);
        } else {
            httpRequest = new HttpDelete(address);
        }
        for (Map.Entry<String, List<String>> entry : request.getParams().entrySet()) {
            for (String value : entry.getValue()) {
                httpRequest.setHeader(entry.getKey(), value);
            }
        }
        return httpRequest;
    }