Fix unexpected attachment reordering

https://www.pivotaltracker.com/story/show/58633492

Please carefully check this PR and give me a shout if you want a walk through of what I think it's doing.

The intention here is to overwrite all ordering on any attachable using the attachment created_at dates (which are carried over during editioning).

Ordering should be rewritten in the following circumstances:
1. Any attachments have null ordering because:
  a) a complete set of null orders means a non-broken attachable that we need to prevent from breaking in the future.
  b) a partial set of null orders means a non-broken attachable which will break on the next edition (or has already been editioned and broken).
2. Any duplicate orderings, because this indicates a broken attachable.

This should be followed up by a schema change and validation to force presence and uniqueness of `ordering` on `Attachment`.