i think this should not be a else if, we need also to change it for Many to Many.
So splitt the prefix condition from the entity conditon.
The rest looks good