save delete categories

function to delete and save categories