Causes and consequences of species invasion and loss: the role of dominant species and diversity in maintaining ecosystem function