public override int GetHashCode()
        {
            var result = 37;

            unchecked
            {
                result = result * 17 + base.GetHashCode();
                result = result * 17 + (IterationEntryListIds?.UncheckedSum() ?? 0);
                result = result * 17 + (FlatteningEntryListIds?.UncheckedSum() ?? 0);
                result = result * 17 + (RelationshipFields?.UncheckedSum() ?? 0);
                result = result * 17 + (EntryDetailsRelationshipFields?.UncheckedSum() ?? 0);
                result = result * 17 + (PrimaryFilters?.Select(f => f.GetHashCode()).UncheckedSum() ?? 0);
                result = result * 17 + (SecondaryFilters?.Select(f => f.GetHashCode()).UncheckedSum() ?? 0);
                result = result * 17 + (Grouping?.GetHashCode() ?? 0);
                result = result * 17 + (Sorting?.GetHashCode() ?? 0);
                result = result * 17 + (Paging?.GetHashCode() ?? 0);
                result = result * 17 + (Columns?.GetHashCode() ?? 0);
                result = result * 17 + IncludeRecordsCount.GetHashCode();
                result = result * 17 + IsSecondaryColumnsFilterEnabled.GetHashCode();
                result = result * 17 + IsMultisortingEnabled.GetHashCode();
            }

            return(result);
        }
        public override bool Equals(object obj)
        {
            var result = base.Equals(obj);

            if (result)
            {
                var query = obj as QueryInfo;

                if (query != null)
                {
                    result = (IterationEntryListIds == null && query.IterationEntryListIds == null) ||
                             (IterationEntryListIds != null && query.IterationEntryListIds != null && IterationEntryListIds.OrderBy(id => id).SequenceEqual(query.IterationEntryListIds.OrderBy(id => id)));

                    result = (FlatteningEntryListIds == null && query.FlatteningEntryListIds == null) ||
                             (FlatteningEntryListIds != null && query.FlatteningEntryListIds != null && FlatteningEntryListIds.OrderBy(id => id).SequenceEqual(query.FlatteningEntryListIds.OrderBy(id => id)));

                    result = result &&
                             ((RelationshipFields == null && query.RelationshipFields == null) ||
                              (RelationshipFields != null && query.RelationshipFields != null && RelationshipFields.OrderBy(id => id).SequenceEqual(query.RelationshipFields.OrderBy(id => id))));

                    result = result &&
                             ((EntryDetailsRelationshipFields == null && query.EntryDetailsRelationshipFields == null) ||
                              (EntryDetailsRelationshipFields != null && query.EntryDetailsRelationshipFields != null && EntryDetailsRelationshipFields.OrderBy(id => id).SequenceEqual(query.EntryDetailsRelationshipFields.OrderBy(id => id))));

                    result = result &&
                             ((PrimaryFilters == null && query.PrimaryFilters == null) ||
                              (PrimaryFilters != null && query.PrimaryFilters != null && PrimaryFilters.SequenceEqual(query.PrimaryFilters))); // NOTE: need to be same order

                    result = result &&
                             ((SecondaryFilters == null && query.SecondaryFilters == null) ||
                              (SecondaryFilters != null && query.SecondaryFilters != null && SecondaryFilters.OrderBy(f => f.ColumnId).SequenceEqual(query.SecondaryFilters.OrderBy(f => f.ColumnId))));

                    result = result &&
                             ((Grouping == null && query.Grouping == null) ||
                              (Grouping != null && query.Grouping != null && Grouping.Equals(query.Grouping)));

                    result = result &&
                             ((Sorting == null && query.Sorting == null) ||
                              (Sorting != null && query.Sorting != null && Sorting.Equals(query.Sorting)));

                    result = result &&
                             ((Paging == null && query.Paging == null) ||
                              (Paging != null && query.Paging != null && Paging.Equals(query.Paging)));

                    result = result &&
                             ((Columns == null && query.Columns == null) ||
                              (Columns != null && query.Columns != null && Columns.Equals(query.Columns)));

                    result = result &&
                             IncludeRecordsCount == query.IncludeRecordsCount;

                    result = result &&
                             IsMultisortingEnabled == query.IsMultisortingEnabled;

                    result = result &&
                             IsSecondaryColumnsFilterEnabled == query.IsSecondaryColumnsFilterEnabled;
                }
                else
                {
                    result = false;
                }
            }

            return(result);
        }