Refactor polymorphic relationships