def save!(&block)
      fail StandardError, 'Cannot re-save a flow' if id
      self.id = SecureRandom.uuid
      record_id = redis_id + ':definition'
      self.created_at = Time.now.to_f

      # Actually save the record:
      redis.set record_id, serialize

      # Transition into the first phase:
      add_transition to: current_phase, timestamp: Time.now.utc.to_f

      # Add our id to the list of active flows:
      redis.sadd 'distribot.flows.active', id
      redis.incr('distribot.flows.running')

      # Announce our arrival to the rest of the system:
      Distribot.publish! 'distribot.flow.created', flow_id: id

      wait_for_flow_to_finish(block) if block_given?
      self
    end
def save!(&block)
      fail StandardError, 'Cannot re-save a flow' if id
      self.id = SecureRandom.uuid
      record_id = redis_id + ':definition'
      self.created_at = Time.now.to_f

      # Actually save the record:
      redis.set record_id, serialize

      # Transition into the first phase:
      add_transition to: current_phase, timestamp: Time.now.utc.to_f

      # Add our id to the list of active flows:
      redis.sadd 'distribot.flows.active', id
      redis.incr('distribot.flows.running')

      # Announce our arrival to the rest of the system:
      Distribot.publish! 'distribot.flow.created', flow_id: id

      wait_for_flow_to_finish(block) if block_given?
      self
    end
rubocop:disable Metrics/AbcSize