transformBlock = function transformBlock(key, blockMap, func) {
	  if (!key) {
	    return;
	  }

	  var block = blockMap.get(key);

	  if (!block) {
	    return;
	  }

	  blockMap.set(key, func(block));
	}
Ancestors needs to be preserved when there are non selected
children to make sure we do not leave any orphans behind