code: def recursive_model_update(model, props):
      
      updates = {}
      valid_properties = model.properties_with_values()
      for k, v in props.items():
          if isinstance(v, Model):
              nested_model = getattr(model, k)
              if type(v) is type(nested_model):
                  nested_props = v.properties_with_values(include_defaults=False)
                  recursive_model_update(nested_model, nested_props)
              else:
                  setattr(model, k, v)
          elif k in valid_properties and v != valid_properties[k]:
              updates[k] = v
      model.update(**updates)
docs: Recursively updates attributes on a model including other
      models. If the type of the new model matches the old model
      properties are simply updated, otherwise the model is replaced.