Preheat the oven to 200C/400F/Gas 6.
For the pesto, blend the pine nuts and garlic in a food processor until smooth. Add the basil, pecorino and olive oil. Blend until well combined. Season to taste with salt and freshly ground black pepper and set aside.
For the bake, heat the oil in a heavy-based frying pan and fry the onion and garlic for 5-8 minutes, or until soft.
Meanwhile beat together the ricotta, goats’ cheese and egg in a bowl until well combined.
Cover the base of a baking dish with the onion and garlic, roasted butternut squash and sun-blushed tomatoes. Cover with a layering of the cheese mixture and finally spoon over some of the pesto.
Repeat the layering process in step 5. Complete the dish by scattering grated pecorino on top. Bake in the oven 15 minutes, or until golden-brown and bubbling.
Remove from the oven and serve with chutney.