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

Update unique key generation to check in both the tables.

Signed-off-by: Vidhant Maini <vidhant_14@hotmail.com>

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