made safeInsertData public

It’s a utility function only and doesn’t use any private data, should
be OK to expose.
converted PopoverHelper to entity architecture