Horizontal gene transfer and homologous recombination drive the evolution of the nitrogen-fixing symbionts of Medicago species