In a microwave-safe bowl or in a small saucepan melt ghee and let it cool so you can handle.
Take one half of the thawed knafeh and pulse in your food processor. Make sure not to turn it into powder.
Place shredded knafeh in a bowl and proceed with the other half.
Pour 3/4 of the melted ghee over the knafeh and massage with your hands to spread the ghee evenly.
Preheat your oven to 350F.
Brush a 10” round pan with some of the melted ghee. Note5
Place half the knafeh on the pan pressing hard with another plate or a measuring cup to spread evenly along the bottom and the sides.
Pour the pudding mixture topping it with the grated cheese if using.
Spread the filling evenly leaving about half an inch from the sides.
Top with the remaining half of the knafeh, spread evenly pressing lightly with your fingertips.
Pour the remaining ghee evenly on top.
Bake in the middle rack for 30 minutes until sides turn brown then move it up to brown the top for 10 to 15 minutes.
Pour cooled syrup over while hot and let it rest for 10 minutes.
If you want invert on a serving platter and garnish with crushed pistachios.Note6