Refactor relationship controller