Check parent values are not empty before setting them

Check that the parent's group / section have values before assigning
them to the node being imported.
Improve coding style
Merge pull request #3 from JKingsnorth/2332625

Check parent group/section is set before assigning to new nodes