public async Task <IEventSourcedAggregate <TAggregate> > RetrieveAsync(Guid id)
        {
            var eventList = await _eventRepository.RetriveEventsAsync <TAggregate>(id);

            var aggregate = new RecordedAggregate <TAggregate>(id, eventList.AggregateVersion, eventList.DomainEvents, this, _eventDispatcher);

            foreach (var @event in eventList.DomainEvents)
            {
                await _eventDispatcher.DispatchAsync(aggregate.State, @event);
            }
            return(aggregate);
        }
 public async Task SaveRecordedAggregateAsync(RecordedAggregate <TAggregate> aggregate)
 {
     await _eventRepository.SaveEventsAsync <TAggregate>(aggregate.State.Id, aggregate.UnrecordedEvents, aggregate.Version);
 }