# File lib/state_machine/machine_collection.rb, line 18
    def fire_events(object, *events)
      run_action = [true, false].include?(events.last) ? events.pop : true
      
      # Generate the transitions to run for each event
      transitions = events.collect do |event_name|
        # Find the actual event being run
        event = nil
        detect do |name, machine|
          event = machine.events[event_name, :qualified_name]
        end
        
        raise InvalidEvent, "#{event_name.inspect} is an unknown state machine event" unless event
        
        # Get the transition that will be performed for the event
        unless transition = event.transition_for(object)
          machine = event.machine
          machine.invalidate(object, :state, :invalid_transition, [[:event, event_name]])
        end
        
        transition
      end.compact
      
      # Run the events in parallel only if valid transitions were found for
      # all of them
      if events.length == transitions.length
        Transition.perform_within_transaction(transitions, :action => run_action)
      else
        false
      end
    end