Moving logic for routing pages into PageController