def update_node(node, key, value)
      node_type = get_node_type node

      case node_type
      when :blank
        [key.terminate(true).encode, value]
      when :branch
        if key.empty?
          node.last = value
        else
          new_node = update_and_delete_storage(
            decode_to_node(node[key[0]]),
            key[1..-1],
            value
          )
          node[key[0]] = encode_node new_node
        end

        node
      when :leaf
        update_leaf_node(node, key, value)
      else
        update_extension_node(node, key, value)
      end
    end
def update_node(node, key, value)
      node_type = get_node_type node

      case node_type
      when :blank
        [key.terminate(true).encode, value]
      when :branch
        if key.empty?
          node.last = value
        else
          new_node = update_and_delete_storage(
            decode_to_node(node[key[0]]),
            key[1..-1],
            value
          )
          node[key[0]] = encode_node new_node
        end

        node
      when :leaf
        update_leaf_node(node, key, value)
      else
        update_extension_node(node, key, value)
      end
    end
Update item inside a node.

 If this node is changed to a new node, it's parent will take the
 responsibility to **store** the new node storage, and delete the old node
 storage.

 @param node [Array, BLANK_NODE] node in form of array, or BLANK_NODE
 @param key [Array] nibble key without terminator
 @param value [String] value string

 @return [Array, BLANK_NODE] new node