Electrochemical insertion of magnesium to Mg0.5Ti2(PO4)3