try {
Promo promo = coreManager.get(Promo.class, promoId);
Product product = coreManager.get(Product.class, productId);
PromoDetail det = new PromoDetail();
det.setProduct(product);
det.setPromo(promo);
PromoDetail promoDetail = coreManager.save(PromoDetail.class, det);
promoDetail = coreManager.getPromoDetail(promoDetail.getId());
DisplayPromoDetail dispDet = mapper.map(promoDetail, DisplayPromoDetail.class);
ProductMeasurement productMeasurement = null;
if(promoDetail.getProduct().getProductMeasurement() != null && !promoDetail.getProduct().getProductMeasurement().isEmpty()){
productMeasurement = promoDetail.getProduct().getProductMeasurement().iterator().next();
}
if(productMeasurement != null){
dispDet.getProduct().setProductMeasurement(mapper.map(productMeasurement, DisplayProductMeasurement.class));
}