Thing not getting created in DB even though Unique ID gets generated

I am doing it as per the recommendation in this thread: How to attach anonymous data to existing user after they log in?