Fixed bug with new Entity ID numbers not being random

This fixes issue #13 where Entity ID numbers for new Entities were not random.
The bug was caused by the random ID number being generated off the ID of "None"
which obviously is static.
SgConnection.batch() now removes dupes and returns a result

Fixed issue #14 so that batch() now removes dupes and returns a proper result.
Also discovered a bug where batch() was not properly locking and releasing the
lock on Entities.