Take a look at this code:
I just spent 15 minutes tracing all this code out trying to find out why nothing was returned. The intent of the code is to build a string containing values present in the object. So if a user searches by Category, UserID etc, the search string is maintained.
Warning, the error is simpler than you might think. Don’t over think it.