Magnetic resonance study of rare earth ions in ionic lattices for optical applications