On the use of hierarchical models for multiple imputation and synthetic data generation