code: def get_all_models_including_attached_models(model):
      
      if (hasattr(model, "_tx_model_repository")):
          models = list(
              model._tx_model_repository.all_models.filename_to_model.values())
          if model not in models:
              models.append(model)
      else:
          models = [model]
      return models
docs: get a list of all models stored within a model
      (including the owning model).
  
      Args:
          model: the owning model
  
      Returns:
          a list of all models