public CertainValueCertainProductDiscount CreateCertainValueCertainProductDiscount(ProductRef productRef, int productQuantity, decimal certainValue, DateTime effectiveDate, DateTime endDate)
 {
    var cvcp = new CertainValueCertainProductDiscount(Guid.NewGuid())
     {
         InitialValue = certainValue
     };
     
     cvcp.CertainValueCertainProductDiscountItems.Add(new CertainValueCertainProductDiscount.CertainValueCertainProductDiscountItem(Guid.NewGuid())
     {
         Product = new ProductRef { ProductId = productRef.ProductId },
         EffectiveDate = effectiveDate,
         EndDate = endDate,
         Quantity = productQuantity,
         CertainValue = certainValue,
         _Status = EntityStatus.New
     });
     return cvcp;
 }
 public CertainValueCertainProductDiscountDTO Map(CertainValueCertainProductDiscount certainValueCertainDiscount)
 {
     if (certainValueCertainDiscount == null) return null;
     var items = new CertainValueCertainProductDiscountDTO()
                     {
                         DateCreated = certainValueCertainDiscount._DateCreated,
                         DateLastUpdated = certainValueCertainDiscount._DateLastUpdated,
                         StatusId = (int) certainValueCertainDiscount._Status,
                         MasterId = certainValueCertainDiscount.Id,
                         InitialValue = certainValueCertainDiscount.InitialValue,
                         CertainValueCertainProductDiscountItems =
                             certainValueCertainDiscount.CertainValueCertainProductDiscountItems
                             .Select(s => new CertainValueCertainProductDiscountItemDTO
                                              {
                                                  DateCreated = s._DateCreated,
                                                  DateLastUpdated = s._DateLastUpdated,
                                                  StatusId = (int) s._Status,
                                                  EffectiveDate = s.EffectiveDate,
                                                  EndDate = s.EndDate,
                                                  CertainValue = s.CertainValue,
                                                  MasterId = s.Id,
                                                  ProductMasterId = s.Product.ProductId,
                                                  Quantity = s.Quantity
                                              }
                             ).ToList()
                     };
     return items;
 }