title: How should i transform this concern in service object?
body: <p>I have a concern allowing me to give the back end user the ability to sort elements. I use it for a few different elements. The rails community seems to be pretty  vocal against concern and callbacks, i'd like to have a few pointers on how to better model the following code :</p>
  
  <pre><code>require 'active_support/concern'
  
  module Rankable
    extend ActiveSupport::Concern
    included do
      validates :row_order, :presence =&gt; true
      scope :next_rank, lambda { |rank| where('row_order &gt; ?',rank).order("row_order asc").limit(1)}
      scope :previous_rank, lambda { |rank| where('row_order &lt; ?',rank).order("row_order desc").limit(1)}
      scope :bigger_rank, order("row_order desc").limit('1')
      before_validation :assign_rank
    end
  
    def invert(target)
      a = self.row_order
      b = target.row_order
      self.row_order = target.row_order
      target.row_order = a
      if self.save 
        if target.save
          true
        else
          self.row_order = a
          self.save
          false
        end
      else
        false
      end
    end
  
    def increase_rank
      return false unless self.next_rank.first &amp;&amp; self.invert(self.next_rank.first)
    end
  
    def decrease_rank
      return false unless self.previous_rank.first &amp;&amp; self.invert(self.previous_rank.first)
    end
  
    private
    def assign_default_rank
      if !self.row_order
        if self.class.bigger_rank.first
          self.row_order = self.class.bigger_rank.first.row_order + 1
        else
          self.row_order=0
        end
      end
    end
  end
  </code></pre>