public async Task <TAggregate> GetByIdAsync(TAggregateId id)
        {
            try
            {
                var aggregate = _emptyAggregateFactory.GetEmptyAggregate();
                IEventSourced <TAggregateId> aggregateEventSourcedView = aggregate;

                foreach (var evt in await _eventStore.ReadEventsAsync(id))
                {
                    aggregateEventSourcedView.ProcessEvent(evt.DomainEvent, evt.Version);
                }
                return(aggregate);
            }
            catch (AggregateNotFoundEventStoreException)
            {
                return(null);
            }
            catch (EventStoreNotReachableException ex)
            {
                throw new RepositoryException(CommunicationImpossibleWithPersistenceBackend, ex);
            }
        }
        public TAggregate GetById(TAggregateId id)
        {
            try
            {
                var aggregate = _emptyAggregateFactory.GetEmptyAggregate();
                IEventSourced <TAggregateId> aggregateEventSourcedView = aggregate;

                foreach (var evt in _eventStore.ReadEvents(id))
                {
                    //aggregate.RaiseEvent(evt.DomainEvent);
                    aggregateEventSourcedView.ProcessEvent(evt.DomainEvent, evt.Version);
                }
                aggregateEventSourcedView.ClearUncommittedEvents();
                return(aggregate);
            }
            catch (AggregateNotFoundEventStoreException)
            {
                return(null);
            }
            catch (EventStoreNotReachableException ex)
            {
                throw new RepositoryException(CommunicationImpossibleWithPersistenceBackend, ex);
            }
        }