/// <summary>
        /// Inserts the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        public void Update(object entity)
        {
            if (entity == null)
                throw new ArgumentNullException("entity");

            var classMap = this.MongoSession.MappingStore.GetClassMapFor(entity.GetType());
            if (!classMap.HasId)
                throw new InvalidOperationException("Only entities with identifiers are persistable.");

            var mapper = new EntityToDocumentMapper(this.MongoSession);
            var document = mapper.CreateDocument(entity);
            this.GetCollectionForClassMap(classMap).Update(document);
            this.MongoSessionCache.Store(classMap.CollectionName, classMap.GetId(entity), entity);
            this.ChangeTracker.GetTrackedEntity(entity).MoveToPossibleModified(document);
        }
        /// <summary>
        /// Determines the state.
        /// </summary>
        private void DetermineState(TrackedEntity trackedEntity)
        {
            if (trackedEntity.State != TrackedEntityState.PossiblyModified)
                return;

            var document = new EntityToDocumentMapper(this.mongoSession)
                .CreateDocument(trackedEntity.Current);

            if (trackedEntity.Original == null)
            {
                //we need to do something else, like check ids against unsaved and what-not
                throw new NotImplementedException();
            }

            if (!AreDocumentsEqual(document, trackedEntity.Original))
                trackedEntity.State = TrackedEntityState.Modified;
        }