Updated db insert to return stat exists when duplicate key error