Core and grate the apples (leave the skin on). Place in a large non-metallic bowl. Roast the hazelnuts in a pan without adding any fat. Keep shaking the pan and remove the nuts to a plate as soon as they are roasted. Leave to cool and remove some of their brown skins by rubbing the nuts between your hands. This is optional, you can leave the skin on if you wish but I prefer to remove it as far as possible, not all of it will come off anyway.Give the hazelnuts to the apples, together with the sugar, goji berries, raisins and cognac if using any. Mix very well, cover the bowl with foil, place in the fridge and let stand for about 5-6 hours or overnight.When ready to bake start by preheating the oven to 180 degrees Celsius/ 350 degrees Fahrenheit. Butter a 30 cm/ 12 inch loaf pan.Mix the flour, the baking powder, cacao nibs and all the spices together. Give this mixture to the apples and mix well with the hand. Give the mixture to the prepared pan and bake for about 1 hour. The cake is very moist, so you will not be able to check for doneness by inserting a skewer in the middle. I always take the cake out of the pan and if the bottom has a nice, rich, golden brown color and the crust feels rather firm I stop the baking process. If not, you could increase the baking time accordingly.