'Update version in db'

def update(self):

    previous_version = Version.query.filter_by(event_id=self.event_id).order_by(Version.id.desc()).first()
    if (not previous_version):
        version = Version(event_id=self.event_id)
        db.session.add(version)
        db.session.commit()
    else:
        self._create_new_version(previous_version)
