Added a function to generate couchdb-style UUIDs so that duplicate docs cannot be accidentally created when documents without an id are saved.