better handle server response when posting to database