Hmm, I just noticed the calendars.package_id attribute can be null, so maybe queries could be changed to use this. I don't know if this would be easier or not, i.e. when would calendars be created with a null package_id?