def action_subject(resource, *additional_args)
      Type! resource, ForemanTasks::Concerns::ActionSubject
      input.update serialize_args(resource, *resource.all_related_resources, *additional_args)

      if resource.is_a? ActiveRecord::Base
        if resource_locks == :exclusive
          exclusive_lock!(resource)
        elsif resource_locks == :link
          link!(resource)
        else
          lock!(resource, resource_locks)
        end
      end
    end
def action_subject(resource, *additional_args)
      Type! resource, ForemanTasks::Concerns::ActionSubject
      input.update serialize_args(resource, *resource.all_related_resources, *additional_args)

      if resource.is_a? ActiveRecord::Base
        if resource_locks == :exclusive
          exclusive_lock!(resource)
        elsif resource_locks == :link
          link!(resource)
        else
          lock!(resource, resource_locks)
        end
      end
    end
Performs all that's needed to connect the action to the resource.
 It converts the resource (and it's relatives defined in +related_resources+
 to serialized form (using +to_action_input+).

 It also locks the resource on the actions defined in +resource_locks+ method.

 The additional args can include more resources and/or a hash
 with more data describing the action that should appear in the
 action's input.
 TODO redo as a middleware