Fixed issue with duplicate records
Check for existing managed objects is now happening before creating a new managed object, no need to create a temporary and then delete at the end
Added logging