Fix for dangling dynamic label issue.

o Given a node with a single dynamic label record, when removing enough labels from it
  to "down-grade" it to use inlined labels, it correctly marked the dynamic label record
  as not in use. However, when removing yet another label, the logic for updating the node
  record did not take into account the (now unused) dynamic label records, and would update
  the node records list of dynamic label records to be empty.

  This in turn led to the log command not containing the information about the dynamic record
  having been set to not in use, and this would susequently lead to dangling label records.
Include dynamic label records when logging a command to delete a node.

o If a node record was set to not in use, the command serialization would not include
  any dynamic records connected to the node record. This meant that when deleting a
  node that had dynamic records connected to it, the dynamic records would not get
  properly updated in recovery mode or on HA slaves.
Re-use code for scanning lucene documents.

o Replace specific interfaces with BoundedIterable where possible.
Merge pull request #1439 from jakewins/fix-all-the-things

Fix all the things