Implement roundtrip update of template contents

Currently there is no Parsoid call for this so we're using the PHP
parser API.

Change-Id: I8bc4f96924d88de7bc67203336bf465ba91fc37b