This is to make things idempotent. It's actually faster in sql to blow away a chunk of data and rewrite it than it is to try and figure out individually which need to be changed and which are already up to date. To be clear, the pattern here is

for each device report xform
- bulk delete whatever entries have been parsed from that form
- parse the form and bulk save entries into the db

For the most part, the bulk delete will delete 0 things. It's only if you restart the pillow and it has to rechurn through everything since the last checkpoint that this makes a difference.

Also I chose to rewrite rather than catch a uniqueness contraint failure because if this pillow changes I want the newer code (which is presumably fixing a bug) to overwrite the older output.