public async Task <ProductGroup> AddProductGroup(ProductGroup productGroup) { if (productGroup is null) { throw new ArgumentNullException(nameof(productGroup)); } if (string.IsNullOrWhiteSpace(productGroup.Name)) { throw new ArgumentException($"{nameof(productGroup.Name)} cannot be null or white space"); } productGroup.Id = Guid.NewGuid().ToString(); var productGroupDataEntity = _mapper.MapToDataEntity(productGroup); await _productGroupRepository.AddGroup(productGroupDataEntity); return(productGroup); }