Refactor QueryResolver