@classmethod
def _convert_to_dict(cls, term, replace_value_names=True):
    """Converts a record heirarchy to nested dicts.

        :param term: Root term at which to start conversion

        """
    from collections import OrderedDict
    if not term:
        return None
    if term.children:
        d = OrderedDict()
        for c in term.children:
            if c.child_property_type == 'scalar':
                d[c.record_term_lc] = cls._convert_to_dict(c,
                    replace_value_names)
            elif c.child_property_type == 'sequence':
                try:
                    d[c.record_term_lc].append(cls._convert_to_dict(c,
                        replace_value_names))
                except (KeyError, AttributeError):
                    d[c.record_term_lc] = [cls._convert_to_dict(c,
                        replace_value_names)]
            elif c.child_property_type == 'sconcat':
                if c.record_term_lc in d:
                    s = d[c.record_term_lc] + ' '
                else:
                    s = ''
                d[c.record_term_lc] = s + (cls._convert_to_dict(c,
                    replace_value_names) or '')
            elif c.child_property_type == 'bconcat':
                d[c.record_term_lc] = d.get(c.record_term_lc, '') + (cls.
                    _convert_to_dict(c, replace_value_names) or '')
            else:
                try:
                    d[c.record_term_lc].append(cls._convert_to_dict(c,
                        replace_value_names))
                except KeyError:
                    d[c.record_term_lc] = cls._convert_to_dict(c,
                        replace_value_names)
                except AttributeError as e:
                    d[c.record_term_lc] = [d[c.record_term]] + [cls.
                        _convert_to_dict(c, replace_value_names)]
        if term.value:
            if replace_value_names:
                d[term.term_value_name.lower()] = term.value
            else:
                d['@value'] = term.value
        return d
    else:
        return term.value
