code: private HttpRequestBase getRequestMethod(HttpMethod httpMethod, String uri, HttpEntity entity) throws MPRestException {
          if (httpMethod == null) {
              throw new MPRestException("HttpMethod must be \"GET\", \"POST\", \"PUT\" or \"DELETE\".");
          }
          if (StringUtils.isEmpty(uri))
              throw new MPRestException("Uri can not be an empty String.");
  
          HttpRequestBase request = null;
          if (httpMethod.equals(HttpMethod.GET)) {
              if (entity != null) {
                  throw new MPRestException("Payload not supported for this method.");
              }
              request = new HttpGet(uri);
          } else if (httpMethod.equals(HttpMethod.POST)) {
              if (entity == null) {
                  throw new MPRestException("Must include payload for this method.");
              }
              HttpPost post = new HttpPost(uri);
              post.setEntity(entity);
              request = post;
          } else if (httpMethod.equals(HttpMethod.PUT)) {
              if (entity == null) {
                  throw new MPRestException("Must include payload for this method.");
              }
              HttpPut put = new HttpPut(uri);
              put.setEntity(entity);
              request = put;
          } else if (httpMethod.equals(HttpMethod.DELETE)) {
              if (entity != null) {
                  throw new MPRestException("Payload not supported for this method.");
              }
              request = new HttpDelete(uri);
          }
          return request;
      }
docs: Returns the HttpRequestBase to be used by the HttpClient.
  
  @param httpMethod                a String with the http method to execute
  @param uri                       a String with the uri
  @param entity                    HttpEntity with the normalized payload
  @return                          HttpRequestBase object
  @throws MPRestException