def find_page_in_branch(cname)
      Template.find_by(code_name: cname.singularize).tap {|t| t || return
        (descendants.where(template_id: t.id) if cname == cname.pluralize).tap {|r| r ||= []
          return r.empty? ? ancestors.find_by(template_id: t.id) : r}}
    end
def find_page_in_branch(cname)
      Template.find_by(code_name: cname.singularize).tap {|t| t || return
        (descendants.where(template_id: t.id) if cname == cname.pluralize).tap {|r| r ||= []
          return r.empty? ? ancestors.find_by(template_id: t.id) : r}}
    end
Search page by template code_name in same branch of pages and templates.
 It allows to call page.category.brand.series.model etc.

 Return one page if founded in ancestors,
 and return array of pages if founded in descendants

 It determines if code_name is singular or nor
 @param cname template code name