Add a generate funtion to the controller to generate URL