public void Handle(ICommand command)
        {
            IEventStream eventStream = _eventStore.Load(command.AggregateId);
            Type         type        = GetTargetType(command);
            IAmAggregate root        = CreateAggregate(type);

            if (root == null)
            {
                throw new InvalidOperationException("Could not get instance for aggreagate from command.");
            }

            foreach (var @event in eventStream)
            {
                root.Process(@event);
                //Process(root, @event);
            }

            var events = Handle(root, command);

            if (events != null && events.Any())
            {
                var tag = EventTags.GetOrCreateIfNotExists(type);
                _eventStore.Store(tag, command.AggregateId, eventStream.Version, events);
            }
        }
 public InMemoryCachedDepartmentRepository(IEventStore eventStore)
 {
     _eventStore = eventStore;
     tag         = EventTags.GetOrCreateIfNotExists(typeof(Department));
 }