code: private static <T> T createObjectFromResponse(Class<T> clazz, final String response) throws InstagramException {
          Gson gson = new Gson();
          T object;
  
          try {
              object = gson.fromJson(response, clazz);
          } catch (Exception e) {
              throw new InstagramException("Error parsing json to object type " + clazz.getName(), e);
          }
  
          return object;
      }
docs: Creates an object from the JSON response and the class which the object would be mapped to.
  
  @param clazz a class instance
  @param response a JSON feed
  @return a object of type <T>
  @throws InstagramException if any error occurs.