catch exception
fixed update/insert creation and added logging