Flexible mediation analysis using natural effect models