The dynamics of bacteria-plasmid systems