Rewriting associations