Fix guid setting

1. Fix where the guid is set when adding a node.
2. This is based on the fix by Ben:
https://github.com/DynamoDS/Dynamo/pull/2028

@Benglin pls review.
This is the testcase associated with this bug: Defect_MAGN_4024

These are the bugs fixed:
All of them require a copy and paste of a CBN
http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-4024
http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-5045
http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-4767
http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-4946