Move queries from adapter into models