code: protected function recordThat(AggregateChanged $event): void
      {
          $this->version += 1;
  
          $this->recordedEvents[] = $event->withVersion($this->version);
  
          $this->apply($event);
      }
docs: Record an aggregate changed event