Fix not using promary key name to update and refactor rawQuery method to easily detect exception