moved logging sql call after save sql call