code: private HttpEntity normalizePayload(PayloadType payloadType, JsonObject payload, Collection<Header> colHeaders) throws MPRestException {
          BasicHeader header = null;
          HttpEntity entity = null;
          if (payload != null) {
              if (payloadType == PayloadType.JSON) {
                  header = new BasicHeader(HTTP.CONTENT_TYPE, "application/json");
                  StringEntity stringEntity = null;
                  try {
                      stringEntity = new StringEntity(payload.toString());
                  } catch(Exception ex) {
                      throw new MPRestException(ex);
                  }
                  stringEntity.setContentType(header);
                  entity = stringEntity;
  
              } else {
                  Map<String, Object> map = new Gson().fromJson(payload.toString(), new TypeToken<Map<String, Object>>(){}.getType());
                  List<NameValuePair> params = new ArrayList<NameValuePair>(2);
                  for (Map.Entry<String, Object> entry : map.entrySet()) {
                      params.add(new BasicNameValuePair(entry.getKey(), entry.getValue().toString()));
                  }
                  UrlEncodedFormEntity urlEncodedFormEntity = null;
                  try {
                      urlEncodedFormEntity = new UrlEncodedFormEntity(params, "UTF-8");
                  } catch(Exception ex) {
                      throw new MPRestException(ex);
                  }
  
                  //if (payloadType == PayloadType.FORM_DATA)
                  //    header = new BasicHeader(HTTP.CONTENT_TYPE, "multipart/form-data");
                  //else if (payloadType == PayloadType.X_WWW_FORM_URLENCODED)
                      header = new BasicHeader(HTTP.CONTENT_TYPE, "application/x-www-form-urlencoded");
                  urlEncodedFormEntity.setContentType(header);
                  entity = urlEncodedFormEntity;
              }
          }
          if (header != null) {
              colHeaders.add(header);
          }
  
          return entity;
      }
docs: Prepares the payload to be sended in the request.
  
  @param payloadType               PayloadType NONE, JSON, FORM_DATA, X_WWW_FORM_URLENCODED
  @param payload                   JosnObject with the payload
  @param colHeaders                Collection of headers. Content type header will be added by the method
  @return
  @throws MPRestException          HttpEntity with the normalized payload