The study of charm production in heavy-ion collisions is considered an excellent probe for the properties of the hot and dense medium created in heavy-ion collisions. Measurements of D-meson nuclear modification can provide strong constraints into the mechanisms of in-medium energy loss and charm flow in the medium. The measurement of $D^0$ elliptic flow in pPb collisions helps us understand the strength of charm quarks coupling to significantly reduced systems which demonstrate hydrodynamic properties. In this paper, the measurements of the $D^0$ nuclear modification factor in PbPb collisions at 5.02 TeV together with the new measurement of $D^0$ elliptic flow in high multiplicity pPb collisions at 5.02 TeV using the two-particle correlation method will be presented.