public boolean updateBrand(Brand to) {
    try {
      Long id = to.getId();
      System.out.println("id: " + id);
      Brand po = SpringUtil.getBrandManager().getBrand(id);
      //    		String bkn = po.getKeyName();
      //    		String fkn = null;
      //    		String fid = null;
      //    		DSFile newFile = null, oldFile = null;
      MyPropertyUtil.copySimpleProperties(po, to);
      //    		if(to.getLogoFile()==null) {
      //    			// no new logofile, do nothing
      //    		}
      //    		else {
      //    			oldFile = po.getLogoFile();
      //        		newFile = to.getLogoFile();
      //    			fkn = DataStoreUtils.genKeyName(newFile);
      //    			fid = KeyFactory.keyToString(new KeyFactory.Builder("Brand",bkn).addChild("DSFile",
      // fkn).getKey());
      //    			newFile.setKeyName(fkn);
      //    			po.setLogoFileId(fid);
      //    			po.setLogoFile(newFile);
      //    			boolean suc = txdelete(oldFile);
      //    		}

      SpringUtil.getBrandManager().saveBrand(po);
      Long res = po.getId();
      return true;
    } catch (Exception e) {
      e.printStackTrace();
      throw new RuntimeException(e);
    }
  }
  public Long addBrand(Brand to) {
    try {
      SpringUtil.getBrandManager().saveBrand(to);
      Long res = to.getId();

      //    		populateIdWithPo(to);
      //			String res = dao.add(to);

      //			DSFile logo = to.getLogo();
      //			String id = logo.getPkId();
      //			System.out.println("id: "+id);

      // NOTE: This does not work
      // throw exception:
      // can't update the same entity twice in a transaction or operation
      //			to.setLogoFileId(id);
      return res;
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      throw new RuntimeException(e);
    }
  }