Use a generic way to dispatch nested resource

This will avoid some code duplication.