added ActiveRecord approach to DB handling