just looking at this (and not the broader context), would it be good to capture a db error here and raise a SyncStateError or something to act upon?