Margulis Lemma and RCD spaces