Thanks TIG! The problem was indeed the last argument, I put an entities object in there. working with an array instead did the job