sort categories by id