Remove duplication in ActiveRecord integration