Changed invokeMethod to return a promise