public void GenerateProductItem(Guid productID, int quantity) { try { IList <ProductItem> productsItems = new List <ProductItem>(); for (int i = 0; i < quantity; i++) { ProductItem productItem = ProductItem.FactoryCreate(productID); productsItems.Add(productItem); } _unitOfWork.Repository <ProductItem>().AddRange(productsItems); _unitOfWork.CommitSync(); } catch (CustomException exc) { throw exc; } catch (Exception ex) { throw CustomException.Create <ProductApplicationService>("Unexpected error fetching add stock", nameof(this.GenerateProductItem), ex); } }