public static string GetUsersWithProducts(ProductShopContext context) { var usersArray = context .Users //.ToArray() <- For Judge to work .Where(x => x.ProductsSold.Count > 0) .OrderByDescending(x => x.ProductsSold.Count) .Select(x => new Task8UserDTO { FirstName = x.FirstName, LastName = x.LastName, Age = x.Age, SoldProducts = new Task8SoldProductsDTO { Count = x.ProductsSold.Count, products = MapperApplier .MapCollection <Product, Task6ProductDTO>(x.ProductsSold) .ToArray() } }) .Take(10) .ToArray(); var usersObject = MapperApplier.MapElement <Task8UserDTO[], Task8UsersDTO>(usersArray); return(XmlApplier.SerializeOne(usersObject)); }