Refactor GraphController by introducing GraphService.