/// <summary>
        /// Universal RetrieveMultiple method override. Returns all pages using callback or 'yield' iterator
        /// </summary>
        /// <param name="query">A query that determines the set of record</param>
        /// <param name="callback">Optional function to be called for each record page</param>
        /// <returns>Entity set as 'yield' iterator</returns>
        public static IEnumerable <Entity> RetrieveMultiple(this IOrganizationService service, QueryBase query, Action <EntityCollection> callback = null)
        {
            CheckParam.CheckForNull(query, nameof(query));

            EntityCollection collection = new EntityCollection
            {
                MoreRecords = true
            };

            while (collection.MoreRecords)
            {
                /// Paging start working if Page > 1
                query.NextPage(collection.PagingCookie);

                collection = service.RetrieveMultiple(query);
                callback?.Invoke(collection);

                foreach (Entity entity in collection.Entities)
                {
                    yield return(entity);
                }
            }
        }