Refactor dynamic created method so it can accept a JSON object and a callback as parameters