Merge pull request #17245 from mauriciofauth/relation-refactor