Origin of the Bagratid dynasties