Fixed and tested offloading customer code segment. Mysql query that checks for existing record was also fixed.