working version with new sql method

used the categories_link table as the starting point
backed up from db
backed up from db