def fire_event(event, record, persist, *args)
      handle_state_exit_callback record
      if new_state = transition_to_new_state(record, event, *args)
        handle_state_enter_callback record, new_state
        handle_event_fired_callback record, new_state, event
        record.update_current_state(new_state, persist)
        handle_event_success_callback record, event
        return true
      else
        handle_event_failed_callback record, event
        return false
      end
    rescue => e
      raise e unless record.respond_to?(:event_failed)
      record.send(:event_failed, event)
      return false
    end
def fire_event(event, record, persist, *args)
      handle_state_exit_callback record
      if new_state = transition_to_new_state(record, event, *args)
        handle_state_enter_callback record, new_state
        handle_event_fired_callback record, new_state, event
        record.update_current_state(new_state, persist)
        handle_event_success_callback record, event
        return true
      else
        handle_event_failed_callback record, event
        return false
      end
    rescue => e
      raise e unless record.respond_to?(:event_failed)
      record.send(:event_failed, event)
      return false
    end
rubocop:disable Metrics/MethodLength