public T GetById <T>(Guid aggregateId) where T : IAggregate
        {
            var loadFromEvent = 0L;

            // Check for Snapshots
            var lastEventIndex = _eventRepository.GetVersionByAggregateId(aggregateId);
            var snapshotSize   = _aggregateFactory.GetSnapshotSize <T>();

            if (lastEventIndex.HasValue && lastEventIndex.Value >= snapshotSize)
            {
                loadFromEvent = lastEventIndex.Value - lastEventIndex.Value % (snapshotSize + 1);
            }

            // Load events
            var events = _eventRepository.GetEventsByAggregateId(loadFromEvent, aggregateId);

            if (events == null)
            {
                throw new IndexOutOfRangeException("Could not find Aggregate with ID: " + aggregateId);
            }

            // Event spool aggregate
            var aggregate = _aggregateFactory.Create <T>(
                aggregateId,
                events.Select(x => x.EventPayload).ToArray()
                );

            aggregate.Version = lastEventIndex ?? 0;

            return(aggregate);
        }