refactoring from using MongoDB to mongoid