moving ActiveRecord transaction into a private method