Duplicate key errors when uploading attachments

Either through user error (double-submit) or retries caused by timeouts, we often get errors raised due to duplicate keys because the same attachment is uploaded twice in quick succession. These changes handle this specific case.

Tracker: https://www.pivotaltracker.com/story/show/68177788