def fields(new_fields = nil)
      if new_fields.nil?
        fields = {}
        self.class.fields.each do |field|
          fields[field] = public_send(field)
        end
        fields
      else
        self.fields = new_fields
      end
    end
def fields(new_fields = nil)
      if new_fields.nil?
        fields = {}
        self.class.fields.each do |field|
          fields[field] = public_send(field)
        end
        fields
      else
        self.fields = new_fields
      end
    end
Returns a hash of the defined fields.

   class SomeMessageType < Outbox::Messages::Base
     fields :to, :from
   end
   message = SomeMessageType.new to: 'Bob'
   message.from 'John'
   message.fields #=> { to: 'Bob', from: 'John' }

 Also allows you to set fields if you pass in a hash.

   message.fields to: 'Bob', from: 'Sally'
   message.fields #=> { to: 'Bob', from: 'Sally' }