public function getWriterFactory()
    {
        if (!$this->writerFactory) {
            $xmlFormatter = new Xml();
            $jsonFormatter = new Json();
            $this->writerFactory = new WriterFactory([
                // xml
                'xml' => $xmlFormatter,
                'text/xml' => $xmlFormatter,
                'application/xml' => $xmlFormatter,
                // json
                'json' => $jsonFormatter,
                'application/json' => $jsonFormatter,
            ]);
        }
        return $this->writerFactory;
    }