On the representation of averaging operators