Could check here if the file exists but is empty. In that case reset to the prototype? Seems a bit hacky but could work. That would allow the template to be reset by sending an empty template in the post request to update the template.