public DocumentContainer TrackChanges(object document, DocumentIdentifierResult identifiers) { var jObject = JObject.FromObject(document, new DocumentSerializer(db).CreateJsonSerializer()); var container = CreateContainer(jObject, identifiers); if (container != null) { containerById[container.Id] = container; containerByInstance[document] = container; } return container; }
DocumentContainer CreateContainer(JObject jObject, DocumentIdentifierResult identifiers) { DocumentContainer container = new DocumentContainer(); if (identifiers.Error) return null; container.Id = identifiers.Id; container.Key = identifiers.Key; container.Rev = identifiers.Rev; container.Document = jObject; return container; }