def from_entity(entity)
      return if entity.nil?

      model_entity = build_model(entity)
      model_entity.entity_property_values = entity.properties.to_h
      entity.properties.to_h.each do |name, value|
        model_entity.send "#{name}=", value if model_entity.respond_to? "#{name}="
      end
      model_entity.reload!
      model_entity
    end
def from_entity(entity)
      return if entity.nil?

      model_entity = build_model(entity)
      model_entity.entity_property_values = entity.properties.to_h
      entity.properties.to_h.each do |name, value|
        model_entity.send "#{name}=", value if model_entity.respond_to? "#{name}="
      end
      model_entity.reload!
      model_entity
    end
Translates between Datastore::Entity objects and ActiveModel::Model objects.

 @param [Entity] entity Entity from Cloud Datastore.
 @return [Model] The translated ActiveModel object.