On the Dual Effect of Mg Doping in LiCoO2 and Li1+δCoO2: Structural, Electronic Properties, and 7Li MAS NMR Studies