Cleanup database on object deletion.