Horizontal Gene Transfer Can Help Maintain the Equilibrium of Microbial Communities