Extract as #generate_route_params method, fixes the code duplication