if (medicine == null) {
medicine = new Medicine();
medicine.setName(medicineWS.getName());
medicine.setDescription(medicine.getDescription());
FacadeDB.getInstance().getMedicineBroker().insert(medicine);
MedicineRemote medicineRemote = new MedicineRemote(medicine);
medicineRemote.setRemoteId(medicineWS.getId());
FacadeDB.getInstance().getMedicineSyncBroker().saveMedicineRemote(medicineRemote);
} else {
if (FacadeDB.getInstance().getMedicineSyncBroker().getMedicineRemoteByMedicine(medicine) == null) {
MedicineRemote medicineRemote = new MedicineRemote(medicine);
medicineRemote.setRemoteId(medicineWS.getId());
FacadeDB.getInstance().getMedicineSyncBroker().saveMedicineRemote(medicineRemote);
}
}
FacadeDB.getInstance().commitTransaction();
}