added save to resource (unfinished)