Merge pull request #777 from jrogelstad/21359

issue #21359: Improve query performance.
issue #21368: Fix json patch to deal with objects set to null.
Merge pull request #783 from jrogelstad/21368

issue #21368: Fix handling of customer assignments to projects.