Preheat your oven to 350°F (175°C). Grease and flour a 9-inch round or square pan, or line it with parchment paper.
Prepare the dry ingredients:
In a medium bowl, whisk together flour, baking soda, salt, cinnamon, nutmeg and allspice (if using). Set aside.
Mix the wet ingredients:
In a large bowl, combine melted butter, granulated sugar and brown sugar. Mix until smooth and well combined.
Add the eggs one at a time, beating well after each addition. Stir in the vanilla extract and sour cream (or Greek yogurt) until the mixture is smooth and creamy.
Mix the wet and dry ingredients:
Gradually add the dry ingredient mixture to the wet ingredients, stirring until well combined. Be careful not to overmix the dough.
Stir in chopped apples and walnuts (if using) until evenly distributed throughout the batter.
Bake the cake:
Pour the batter into the prepared pan, spreading it evenly with a spatula.
Bake in preheated oven for 45 to 55 minutes or until a toothpick inserted in the center of the cake comes out clean.
If the top of the cake starts to brown too quickly, you can cover it with aluminum foil for the last 10 to 15 minutes of baking.
Let cool and serve:
Once baked, remove the cake from the oven and let it cool in the pan for about 10 minutes. Then transfer the cake to a wire rack to cool completely.
Serve the cake warm or at room temperature, alone or with a scoop of vanilla ice cream or a dollop of whipped cream.
Storage:
Store leftover cake in an airtight container at room temperature for up to 3 days, or in the refrigerator for up to 1 week.
The cake can also be frozen for up to 3 months; simply wrap tightly in plastic wrap and place in a freezer bag.
Conclusion: