Updated unique key generation to check the generated key in both tables.

Updated unique key generation to check in both the tables.

Signed-off-by: Vidhant Maini <vidhant_14@hotmail.com>