In a medium saucepan, combine the ground poppy seeds, sugar, milk, and cinnamon.
Cook over medium heat, stirring constantly, until the mixture thickens.
Remove from heat and let it cool.
In a medium bowl, combine the cottage cheese, sugar, egg, and vanilla extract.
Mix until smooth and set aside.
In a medium saucepan, combine the ground walnuts, sugar, and milk.
Cook over medium heat, stirring constantly, until the mixture thickens.
Remove from heat and let it cool.
In a medium bowl, combine the grated apples, sugar, and cinnamon.
Mix well and set aside.
In a medium bowl, combine the sour cream, sugar, and eggs.
Mix until smooth and set aside.
Preheat your oven to 350°F (175°C).
Grease a 9x13-inch baking dish.
Place one sheet of phyllo dough in the baking dish and brush it with melted butter. Repeat with three more sheets of phyllo dough, brushing each with melted butter.
Spread the poppy seed mixture evenly over the phyllo dough.
Layer four more sheets of phyllo dough, brushing each with melted butter.
Spread the cottage cheese mixture evenly over the phyllo dough.
Layer four more sheets of phyllo dough, brushing each with melted butter.
Spread the walnut mixture evenly over the phyllo dough.
Layer four more sheets of phyllo dough, brushing each with melted butter.
Spread the apple mixture evenly over the phyllo dough.
Pour half of the sour cream mixture over the apple layer and spread evenly.
Layer the remaining sheets of phyllo dough, brushing each with melted butter.
Pour the remaining sour cream mixture over the top layer of phyllo dough and spread evenly.
Bake in the preheated oven for 60-70 minutes, or until the top is golden brown and the filling is set.
If the top browns too quickly, cover it loosely with aluminum foil.
Let the gibanica cool in the baking dish before cutting into squares or slices.
Enjoy your meal!