public RequestQuery Build()
        {
            var resultQuery = new Struct();

            foreach (var filterGroup in _queryGroups)
            {
                if (filterGroup.Property.IsForeignEntity)                 //handle subservice entity query
                {
                    var subgroup = new FilterGroup(filterGroup.Caption, filterGroup.Property.FieldName, filterGroup.ExpressionType)
                                   .AssignParameters(filterGroup.CheckedParameters.ToArray());
                    if (!BuildForGroup(subgroup, out var subqueryPair))
                    {
                        continue;
                    }
                    var subquery = new Struct
                    {
                        Fields = { [subqueryPair.property] = subqueryPair.query }
                    };
                    var subservice = $"*/{filterGroup.Property.ForeignResource}";
                    if (!resultQuery.Fields.TryAdd(subservice, subquery.AsValue()))
                    {
                        if (resultQuery.Fields[subservice].KindCase == Value.KindOneofCase.StructValue)
                        {
                            var existedQuery = resultQuery.Fields[subservice].StructValue;
                            existedQuery.Fields.TryAdd(subqueryPair.property, subquery.Fields[subqueryPair.property]);
                            resultQuery.Fields[subservice] = existedQuery.AsValue();
                        }
                    }
                    continue;
                }

                if (!BuildForGroup(filterGroup, out var queryPair))
                {
                    continue;
                }

                resultQuery.Fields.TryAdd(queryPair.property, queryPair.query);
            }
            return(RequestQuery.FromValue(resultQuery));
        }