A simple recursive function to merge two objects.