Move the shared repository translateDefinition() method to a trait, add test coverage.