Extract implementation from virtus-activerecord gem.