More performance solution for many-to-many problem