refactor to use AppSync instead of AppMessage