public TEventType AddEvent <TEventType>(Guid id, IVersionedEvent <Guid> eventItem) where TEventType : EventContainer { EventContainer result; using (var session = documentStore.OpenSession()) { result = session.Load <TEventType>(typeof(TEventType).Name + "/" + id); if (result == null) { result = _typeActivator.Instance <TEventType>(); result.Init(id); result.AddEvent(eventItem); session.Store(result); } else { result.AddEvent(eventItem); } session.SaveChanges(); } return((TEventType)result); }