You could just set $lastSavedOn = 0 on line 116 and then lines 123-127 wouldn't be necessary.  Also, maybe add a short comment about how the last updated information is saved per asset so its necessary to check all the assets on a program.