title: Best practice for preventing duplicate AggregateCreated events
body: <p>I have the following (Axon) Aggregate :</p>
  
  <pre><code>@Aggregate
  @NoArgsConstructor
  public class Car{
    @AggregateIdentifier
    private String id;
  
    @CommandHandler
    public Car(CreateCar command){
      apply( new CarCreated(command.getId()) );
    }
  
    @EventSourcingHandler
    public void carCreated(CarCreated event) {
      this.id = event.getId();
    }
  
  }
  </code></pre>
  
  <p>And I can create the car by submitting a <code>CreateCar</code> command with a specific id, causing a <code>CarCreated</code> event. That is great.</p>
  
  <p>However, if I send another <code>CreateCar</code> command, with the same Id, the command cannot be validated by the aggregate (that the given id already exists). Subsequently it will simply fire a new <code>CarCreated</code> event. Which is a lie. </p>
  
  <p>What would be the best approach to make sure the <code>CreateCar</code> command fails if the car already exists?</p>
  
  <p>Naturally I could first check the repository, but this won't prevent race conditions...</p>