public void HandleNext() { var command = _cache.First(); var handler = _factoryMethod.CreateHandler(command); if (handler == null) { throw new NotSupportedException("Handler not found"); } handler.Handle(command); _cache.Remove(command); }