Posterior concentration rates for empirical Bayes procedures with applications to Dirichlet process mixtures