Implementing saving of database objects as keys to Attribute-dicts. Also fixed some other issues with nested iterables in Attributes. Resolves #404.