Fix sharing issue with collection and children mismatches

This fixes issue https://github.com/owncloud/apps/issues/192

It's sort of a temporary fix. I'll be working on some changes after ownCloud 5 to improve on the existing sharing code.