The solution to the problem is that we changed the database model so that we got rid of the circular references. Then we had no problems loading all the data