Add support for saving created template

First version that actually works.