def find_owner(node, root = nil)
      valid_parent_types(node).presence.each do |t|
        getallnodes = lambda { |v| v == '*' ? Taxonomite::Node.find() : Taxonomite::Node.find_by(:entity_type => t) }
        getrootnodes = lambda { |v| v == '*' ? root.self_and_descendants : root.self_and_descendants.find_by(:entity_type => t) }
        ( root.nil? ? getallnodes.call(t) : getrootnodes.call(t) ).each { |n| return n if is_valid_relation(n,node) }
      end
      nil
    end
def find_owner(node, root = nil)
      valid_parent_types(node).presence.each do |t|
        getallnodes = lambda { |v| v == '*' ? Taxonomite::Node.find() : Taxonomite::Node.find_by(:entity_type => t) }
        getrootnodes = lambda { |v| v == '*' ? root.self_and_descendants : root.self_and_descendants.find_by(:entity_type => t) }
        ( root.nil? ? getallnodes.call(t) : getrootnodes.call(t) ).each { |n| return n if is_valid_relation(n,node) }
      end
      nil
    end
# Is this the direct owner of the node passed. This allows for auto-organizing
 # hierarchies. Sublcasses should override this method. Defaults to false - hence
 # no structure.
 # @param [Taxonomite::Node] node node in question
 # @return [Boolean] whether self should directly own node as a child, default is false
 def contains?(node)
   false
 end

 Find the direct owner of a node within the tree. Returns nil if no direct
 owner exists within the tree starting at root self. This works down the
 tree (rather than up.) If root is nil it simply trys all of the Node objects
 which match the appropriate parent entity_type for node. The default simply
 finds the first available valid parent depending upon the search method employed.
 @param [Taxonomite::Node] node the node to evaluate
 @param [Taxonomite::Node] root the root of the tree to evaluate; if nil will search for the parents of the node first
 @return [Taxonomite::Node] the appropriate node or nil if none found