Epidemic dynamics of metapopulation models