I'd suggest to create separate class, which prepares twig