in lines 118 to 120 (call to `create_trait(...)) queries the database at least once every iteration, which leads to performance issues.
We need to replace this with a single bulk query that gets all the appropriate data and sets up all the expected data.
This new issue has been superseded by