Add recursive encoding on records