Setting up writer for recursive objects