1040101: Avoid repeating work and database lookups checking modifies

Flatten out the algorithm, and only query the database once for entitlements
and once for products