private void ReadLastEtagGenerated(DbIterator it)
		{
			Slice lastEventEver = "events/" + new Etag((UuidType) byte.MaxValue, long.MaxValue, long.MaxValue);
			it.Seek(lastEventEver);
			if (it.IsValid)
			{
				it.Prev();
				if (it.IsValid && it.Key.StartsWith(_eventsPrefix))
				{
					_lastGeneratedEtag = ParseEtag(it.Key);
				}
			}
		}
		private void ReadAllAggregations(DbIterator it)
		{
			Slice prefix = "aggregators/";
			it.Seek(prefix);
			while(it.WithPrefix(prefix))
			{
				string name = Encoding.UTF8.GetString(it.Key.Array, it.Key.Offset, it.Key.Count);
				using (var stream = it.CreateValueStream())
				{
					var indexDefinition =
						new JsonSerializer().Deserialize<IndexDefinition>(new JsonTextReader(new StreamReader(stream)));
					_log.Info("Reading aggregator {0}", indexDefinition.Name);
					AbstractViewGenerator generator = null;
					try
					{
						var dynamicViewCompiler = new DynamicViewCompiler(indexDefinition.Name, indexDefinition,
																		  Path.Combine(_path, "Generators"));
						generator = dynamicViewCompiler.GenerateInstance();
					}
					catch (Exception e)
					{
						_log.WarnException("Could not create instance of aggregator " + indexDefinition.Name, e);
						// could not create generator, ignoring this and deleting the generator
						RemoveAggregation(name);
					}

					if (generator != null)
					{
						var aggregator = new Aggregator(this, indexDefinition.Name, generator);
						_aggregations.TryAdd(indexDefinition.Name, aggregator);
						Background.Work(aggregator.StartAggregation);
					}
				}
				it.Next();
			}
		}