1. Preheat oven to 175 C. Bring a large pot of salted water to boil. Cook the pasta for 10 minutes. Drain but keep about 1 cup of the pasta water.
2. In a blender or food processor, mix the ricotta, milk, pesto, tomato paste, chilli flakes (if using, salt and freshly ground black pepper. Blend everything together and taste to adjust seasoning.
3. Mix the cooked pasta with the ricotta mixture, grated mozzarella, one cup of the parmesan, cherry tomatoes and about 1/2 cup of the pasta cooking water to loosen the mixture. Put everything in a baking dish.Top with the remaining one cup parmesan cheese.
4. Cover the baking dish with foil and bake for 30 minutes. Uncover and bake for 10 minutes more. Serve at once.
Note: Unlike dishes like lasagne, which taste better if you let them stand for a while before serving, this dish is best eaten as it comes out of the oven.