@Override
  public ReferenceNumberType provide(String code, String name) {
    ReferenceNumberType res = null;
    if ((res = getByCode(code)) == null) {
      ReferenceNumberType unit = new ReferenceNumberType();

      unit.setCode(code);
      unit.setName(name);

      res = add(unit);
    }
    return res;
  }
 @Override
 public ReferenceNumberType provide(ReferenceNumberType record) {
   ReferenceNumberType existingRecord = getByCode(record.getCode());
   if (Validator.isNull(existingRecord)) {
     record = update(record);
     try {
       // em.flush();
     } catch (Exception e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   }
   return record;
 }