Clear db in order of dependencies
Use custom error to avoid swallowing other types of errors