code: def update_model_in_repo_based_on_filename(self, model):
          
          if model._tx_filename is None:
              for fn in self.all_models.filename_to_model:
                  if self.all_models.filename_to_model[fn] == model:
                      return fn
              i = 0
              while self.all_models.has_model("anonymous{}".format(i)):
                  i += 1
              myfilename = "anonymous{}".format(i)
              self.all_models.filename_to_model[myfilename] = model
          else:
              myfilename = model._tx_filename
              if (not self.all_models.has_model(myfilename)):
                  self.all_models.filename_to_model[myfilename] = model
          return myfilename
docs: Adds a model to the repo (not initially visible)
          Args:
              model: the model to be added. If the model
              has no filename, a name is invented
          Returns: the filename of the model added to the repo