try {
object = clazz.newInstance();
object = gson.fromJson(response, clazz);
}
catch (InstantiationException e) {
throw new InstagramException("Problem in Instantiation of type " + clazz.getName(), e);
}
catch (IllegalAccessException e) {
throw new InstagramException("Couldn't create object of type " + clazz.getName(), e);
}
catch (Exception e) {
throw new InstagramException("Error parsing json to object type " + clazz.getName(), e);
}
return object;
}