Custom version of ActiveRecord