Refactor controllers to use respond with and reduce code duplication