private boolean doImport(AccountCategory ac, String fileName, BufferedImage orig) {
    try {
      if (orig != null) {
        BufferedImage newImg = null;
        if (orig.getWidth() == LEN && orig.getHeight() == 24) {
          newImg = orig;
        } else {
          newImg =
              getScaledInstance(orig, LEN, LEN, RenderingHints.VALUE_INTERPOLATION_BICUBIC, true);
        }

        ImageIcon ic = new net.mjrz.fm.ui.utils.MyImageIcon(newImg);

        StringBuilder path = new StringBuilder(ZProperties.getProperty("FMHOME"));
        path.append(Main.PATH_SEPARATOR);
        path.append("icons/");
        path.append(fileName);

        File outFile = new File(path.toString());

        if (!outFile.exists()) {
          FileUtils.touch(outFile);
        }

        ImageIO.write((RenderedImage) newImg, "png", outFile);

        CategoryIconMap cim = new CategoryIconMap();
        cim.setCategoryId(ac.getCategoryId());
        cim.setIconPath(path.toString());

        em.saveOrUpdateObject("CategoryIconMap", cim);

        IconMap.getInstance().setIcon(ac.getCategoryId(), path.toString(), ic);
        return true;
      }
      errMsg = "Image could not be loaded";
    } catch (Exception e) {
      errMsg = "Image could not be loaded";
      e.printStackTrace();
    }
    return false;
  }
  public static void initialize(String uname) {
    try {
      String path = ZProperties.getProperty("FMHOME");
      DATA_FILE_NAME = "data.data";

      File file = new File(path);
      File[] flist = file.listFiles();
      boolean found = false;
      for (int i = 0; i < flist.length; i++) {
        if (flist[i].getName().equals(DATA_FILE_NAME)) {
          found = true;
          break;
        }
      }
      String URL = "jdbc:hsqldb:file:" + path + Main.PATH_SEPARATOR + "data";

      Configuration cfg = new Configuration();

      if (!found) {
        cfg.setProperty("hibernate.hbm2ddl.auto", "create");
      } else {
        cfg.setProperty("hibernate.hbm2ddl.auto", "update");
      }

      cfg.setProperty("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver");
      cfg.setProperty("hibernate.connection.url", URL);
      cfg.setProperty("hibernate.connection.username", "sa");
      cfg.setProperty("hibernate.connection.password", "");
      cfg.setProperty("hibernate.connection.pool_size", "10");
      cfg.setProperty("hibernate.connection.hsqldb.default_table_type", "cached");

      sessionFactory = cfg.configure().buildSessionFactory();
    } catch (Throwable ex) {
      System.err.println("Initial SessionFactory creation failed." + ex);
      throw new ExceptionInInitializerError(ex);
    }
  }