def METHOD_NAME(
    self,
    metadata: Study,
    update_modification_date: bool = False,
    update_in_listing: bool = True,
) -> Study:
    metadata_id = metadata.id or metadata.name
    logger.debug(f"Saving study {metadata_id}")
    if update_modification_date:
        metadata.updated_at = datetime.utcnow()
    metadata.groups = [db.session.merge(g) for g in metadata.groups]
    if metadata.owner:
        metadata.owner = db.session.merge(metadata.owner)
    db.session.add(metadata)
    db.session.commit()
    if update_in_listing:
        self._update_study_from_cache_listing(metadata)
    return metadata