save categories to database