implement lesson save/autosave (this is some of the hackiest code i've ever written)