I personally experiment with various diets as part of my studies. Speaking from experience and extensive amounts of empirical research data I have come to the conclusion that is widely misunderstood but should be common sense. The secret formula is this... are you ready?
To lose weight (water, body fat, lean tissue) consume less calories
To gain weight (water, body fat, lean tissue) consume more calories
That's it, no more no less. The only considerations that need to be implied are macro tracking. Consume 1lb of protein per lb of bodyweight, 0.5g of fat per lb of bodyweight and then fill the rest with carbohydrates. Carbohydrates are not "evil" and do not solely cause fat gain. The gylcemic index is irrelevant and has been dis proven to be irrelevant with a huge amount of studies.
The type of foods is also widely misunderstood. "bad" foods are made up from the same things as "good" foods. The key is moderation, use your head to know when enough is enough or when consuming 10 doughnuts without fitting it into your macro's for the day is silly.
If you wan't any more information you can check out some of my upcoming hubs!
And to anyone that disagrees with anything feel free to let me know and I will drop you the studies and we can talk and help you gain some new knowledge!