Fixes #1285 if no container, default to false for writing to container
moved groups specific code out of can_write_to_container()
Merge pull request #5747 from cash/cwtc

Cleans up can_write_to_container()