How does biodiversity affect the stability of an ecosystem?

How does biodiversity affect the stability of an ecosystem?