Fixed issue with generateUnique not making $seed unique if not null. Wrote a simple test case as well to test the method.