Node create fails in Drupal 8

This is a port of the patch in https://drupal.org/node/2238731

The ```nid``` property of a node is Drupal 8 is a ```FieldItemList``` object, not a scalar. In order to support D8 and D6/D7, I had to put in an ```if/else```.