private T GetById <T>(Guid id) where T : Aggregate { var raw = _events.ContainsKey(typeof(T)) ? _events[typeof(T)].Where(e => e.AggregateId == id) : new List <EventData>().AsEnumerable(); var events = raw.Select(x => x.DeserializeEvent()); var aggregate = _aggregateFactory.Hydrate <T>(_bus, events); return(aggregate); }