Added check to avoid generating the same association multiple times