Refactor Repository to ActiveRecord.