const ComponentPtr& ComponentCollection::GetComponent(i32 slotID) const
{
    static const ComponentPtr kNull;
    const M_Component::const_iterator end = m_Components.end();
    M_Component::const_iterator found = m_Components.find( slotID );
    if ( found != end )
    {
        return found->second;
    }
    else
    {
        // Travel up the inheritance hierarchy looking for a base class slot within
        // this collection.
        Reflect::Registry* registry = Reflect::Registry::GetInstance();
        const Reflect::Class* type = registry->GetClass( slotID );
        type = registry->GetInstance()->GetClass( type->m_Base );

        // While we have base class type information, and we haven't hit the Component
        // base class, keep iterating.
        while ( type && ( type->m_TypeID != Reflect::GetType< ComponentBase >() ) )
        {
            // See if the base class has a slot in this collection.
            found = m_Components.find( type->m_TypeID );
            if ( found != end )
            {
                return found->second;
            }

            type = registry->GetInstance()->GetClass( type->m_Base );
        }
    }

    return kNull;
}