Extract the constructor of the controller into a helper method