recursive replace in resource routes