                     return
                 }
                 do {
-                    let model = try <%- model.classname %>(json: document)
+                    var modelJSON = document
+                    _ = modelJSON.dictionaryObject?.removeValue(forKey: "_id")
+                    _ = modelJSON.dictionaryObject?.removeValue(forKey: "_rev")
+                    let model = try <%- model.classname %>(json: modelJSON)
                     onCompletion(model.settingID(docid), nil)
                 } catch {
                     onCompletion(nil, AdapterError.internalError(String(describing: error)))

                    guard document["doc"].exists() else {
                        throw AdapterError.internalError("Missing document content")
                    }
                    let model = try <%- model.classname %>(json: document["doc"])
                    return model.settingID(docid)
                }
                onCompletion(models, nil)

            }

            do {
                var modelJSON = document
                _ = modelJSON.dictionaryObject?.removeValue(forKey: "_id")
                _ = modelJSON.dictionaryObject?.removeValue(forKey: "_rev")
                let model = try <%- model.classname %>(json: modelJSON)
                onCompletion(model.settingID(docid), nil)
            } catch {
                onCompletion(nil, AdapterError.internalError(String(describing: error)))
