CreateDevice is taking the first entry of Repository type Package from the DB. It needs to take the appropriate one based on Package_Source_Compat entries.