def document_to_model(document)
      identity_map.retrieve_or_store model_class, document.key do
        model = model_class.new(document.to_h)

        model.key = document.key
        model.rev = document.revision

        handle_related_documents(model)

        model
      end
    end
def document_to_model(document)
      identity_map.retrieve_or_store model_class, document.key do
        model = model_class.new(document.to_h)

        model.key = document.key
        model.rev = document.revision

        handle_related_documents(model)

        model
      end
    end
Map a document to a model

 Sets the revision, key and all attributes on the model

 @param [Ashikawa::Core::Document] document
 @return [Model] the resulting model with the given Model class