rework insert method to avoid O(n) iteration of saved entities.  fixes #554