Donut filling is grainy from sugar how do you get it smooth?

Continue to beat the filling till the sugar is smooth and the texture if fine.