The classic paper here is Baron, R.M. & Kenny, D. A. (1986) The moderator-mediator distinction in social psychological research: Conceptual, strategic, and statistical considerations. Journal of Personality and Social Psychology, 51, 1173-1182. This is a “must read” for anyone doing stuff with moderating or mediating relationships.