implemented embedded model and separated sort model model from the query model