Merge pull request #1428 from fuyar/MODULES-10856
Combine multiple grants into one while checking state