how is magnesium separated from its ore