def METHOD_NAME(self, trainer: Trainer, mode: str):
    """Saving new snapshot and remove the oldest snapshot if needed."""
    iteration = trainer.updater.state.iteration
    epoch = trainer.updater.state.epoch
    num = epoch if self.trigger[1] == 'epoch' else iteration
    path = self.checkpoint_dir / f"{num}.np"
    # add the new one
    trainer.updater.save(path)
    record = {
        "time": str(datetime.now()),
        'path': str(path.resolve()),  # use absolute path
        'iteration': iteration,
        'epoch': epoch,
        'indicator': get_observations()[self.indicator]
    }
    self.records.append(record)
    # remove the earist
    if self.full():
        if mode == 'kbest':
            self.records = sorted(
                self.records,
                key=lambda record: record['indicator'],
                reverse=not self.less_is_better)
        eariest_record = self.records[0]
        os.remove(eariest_record["path"])
        self.records.pop(0)
    # update the record file
    record_path = self.checkpoint_dir / "records.jsonl"
    with jsonlines.open(record_path, 'w') as writer:
        for record in self.records:
            # jsonlines.open may return a Writer or a Reader
            writer.write(record)  # pylint: disable=no-member