Fix empty association attributes

If an association does not exist, the id methods affected
in this patch will currently fail, as it will attempt to
grab an id of a non-existent attribute.

The implemented fix uses the EAFP philosophy.

Change-Id: I97b608bc267963e754d06379d94372d13e7c93fa