Refactor relations into their own generator