refactor database insert e delete (manca update, fixare delete)