Fixes insertion, update and deletion from the DB