Fix collection detaching at the wrong time in attribute()
Found in FatCRM where changes to collection attributes were not stored
New unittest to ensure that we get the attribute from the
detached collection, not from the original one.
Reviewed By: dvratil
Tags: KDE PIM
Differential Revision: https://phabricator.kde.org/D19741