public IAggregateRoot LoadById(Guid id)
        {
            DetachedCriteria boundaryCriteria = DetachedCriteria.For <Event>()
                                                .SetProjection(Projections.Id())
                                                .Add(Expression.Eq("IsSnapshot", true))
                                                .Add(Expression.Eq("EntityId", id))
                                                .AddOrder(new Order("SequenceNumber", false))
                                                .SetFirstResult(0)
                                                .SetMaxResults(1);

            ICriteria criteria = _readSession.CreateCriteria(typeof(Event))
                                 .Add(Expression.Eq("EntityId", id))
                                 .Add(Subqueries.PropertyGe("SequenceNumber", boundaryCriteria))
                                 .AddOrder(new Order("SequenceNumber", true));

            IList <Event> events = criteria.List <Event>();

            if (events.Count < 1)
            {
                throw new ArgumentException(string.Format("Entity with id {0} not found.", id));
            }
            IAggregateRoot lastSnapshot = (IAggregateRoot)events[0].Data;

            lastSnapshot.Id = id;
            lastSnapshot.LoadFromEventStream(events.Skip(1).Select(x => x.Data));
            lastSnapshot.Version = events.Last().Version;

            _trackedObjects.Add(lastSnapshot);

            return(lastSnapshot);
        }