Versioning

Add optimistic locking via a numeric version field.
    
If a client fetches a document with version 1, and then tries to post the same document (with the version 1 as part of the POST data), and another client has modified the document in the meantime, the request will fail.

**Note**: This branches from the `use_sinatra_activerecord_tasks` branch. :crying_cat_face: The relevant commit is f4e60f0bf4482572593e6f2d68aef4f6607ae0f3.