Refactor association keys generation for `Relationship`.