code: protected <T extends DomainEvent> T registerEvent(T event) {
          Assert.notNull(event, "Domain event must not be null!");
  
          this.domainEvents.add(event);
          return event;
      }
docs: Registers the given event object for publication on a call to a Spring Data repository's save methods.
  
  @param event must not be {@literal null}.
  @return the event that has been added.