public void updateCategories() throws Exception {
        GetCategoriesCall gcc = new GetCategoriesCall(getApiContext());          //Load current version
        gcc.addDetailLevel(DetailLevelCodeType.RETURN_HEADERS);
        gcc.getCategories();
        Versions catVer = this.getDatabaseConnector().getCategoryVersion();
        if (catVer.getVersion() != Integer.parseInt(gcc.getReturnedCategoryVersion())) {
            System.out.println("New Categories available!");
            CategoriesDownloader cd = new CategoriesDownloader(getApiContext());
            CategoryType[] cats = cd.getAllCategories();
            for (CategoryType cat : cats) {
                Category hibcat = new Category();
                hibcat.setId(Integer.parseInt(cat.getCategoryID()));
                hibcat.setName(cat.getCategoryName());
                if (cat.getCategoryParentID() != null) {
                    hibcat.setTopcategory(Integer.parseInt(cat.getCategoryParentID()[0]));
                }
                this.getDatabaseConnector().saveOrUpdate(hibcat);
            }
            catVer.setVersion(Integer.parseInt(gcc.getReturnedCategoryVersion()));
            this.getDatabaseConnector().saveOrUpdate(catVer);
        }
}
