Fix attachment ordering with negative values
Wrap reordering in a database transaction

this ensures that if two people try to reorder the same attachments at
the same time, only one set of orderings will be persisted and a
consistent state will remain, rather than possibly two sets of orderings
being confounded and an inconsistent state remaining.
Merge pull request #1085 from alphagov/fix-attachment-ordering-500-error

Fix attachment ordering with negative values

[Fixes https://www.pivotaltracker.com/story/show/61203896]