def perform_action!(action, resource, author, extra_log_info = {})
      PaperTrail.request(whodunnit: gid(author)) do
        Decidim::ApplicationRecord.transaction do
          result = block_given? ? yield : nil
          loggable_resource = resource.is_a?(Class) ? result : resource
          log(action, author, loggable_resource, extra_log_info)
          return result
        end
      end
    end
def perform_action!(action, resource, author, extra_log_info = {})
      PaperTrail.request(whodunnit: gid(author)) do
        Decidim::ApplicationRecord.transaction do
          result = block_given? ? yield : nil
          loggable_resource = resource.is_a?(Class) ? result : resource
          log(action, author, loggable_resource, extra_log_info)
          return result
        end
      end
    end
Performs the given block and sets the author of the action.
 It also logs the action with the given `action` parameter.
 The action and the logging are run inside a transaction.

 action - a String or Symbol representing the action performed
 resource - An ActiveRecord instance that implements `Decidim::Traceable`
 author - An object that implements `to_gid` or a String
 extra_log_info - a Hash with extra info that will be saved to the log

 Returns whatever the given block returns.