@Override
 @Transactional
 public void updatePart(PartModel partModel, String modelNumber) {
   log.debug("Update Part model: {}", partModel);
   if (partModel == null) {
     throw new IllegalArgumentException("Cannot update null Part");
   }
   try {
     Part part = bindPart(partModel);
     log.debug("Update part: part: {}", part);
     if (modelNumber != null) {
       try {
         HeliParts heliParts = null;
         Heli heli = entityManager.find(Heli.class, modelNumber);
         if (heli != null) {
           heliParts = heliPartsService.getHeliPart(modelNumber, part.getPartNumber());
           if (heliParts == null) {
             log.debug("Update part heli: {}", heli);
             log.debug("Update part helipart: {}", heliParts);
             heliPartsService.createHeliPart(heli, part);
           }
         }
       } catch (NoResultException e) {
         log.debug("Update part error: {}", e.getMessage());
       }
     }
     log.debug("Part updated in database: {}", part);
     entityManager.merge(part);
   } catch (Exception e) {
     throw new IllegalArgumentException(e.getMessage());
   }
 }
 private PartModel bindPartModel(Part part) {
   PartModel model = null;
   try {
     if (part != null && part.getPartNumber().length() > 0) {
       model = new PartModel();
       model.setCountNeeded(part.getCountNeeded());
       model.setName(part.getName());
       model.setPartNumber(part.getPartNumber());
       if (part.getPhoto() != null) {
         model.setPhoto(part.getPhoto());
       }
       model.setStockCount(part.getStockCount());
     }
   } catch (NullPointerException e) {
     throw new IllegalArgumentException(e.getMessage());
   }
   return model;
 }