public async Task <CategoryId> CreateAsync(UncreatedCategory category)
        {
            await Task.CompletedTask;
            var categoryId = new CategoryId(_idGenerator.NewId());

            _categories.Add(new Category(categoryId, category.Name));

            return(categoryId);
        }
        public async Task <CategoryId> CreateAsync(UncreatedCategory category)
        {
            if (await _repository.NameAlreadyExistsAsync(category.Name))
            {
                throw new CategoryNameAlreadyExistsException(category.Name);
            }

            var categoryId = await _repository.CreateAsync(category);

            return(categoryId);
        }