public async Task Handle(CreateCategory message) { try { var item = await repository.Get(message.Id.ToString()); if (item != null) { throw new Exception($"Category with id: {message.Id} already exist"); } } catch (AggregateNotFoundException) { // That is fine that id not used } var category = CategorySource.Create(message.Id, message.ParentId, message.Name, message.Color, message.Visible); await repository.Save(category); }