Reduce Repository/Record coupling

We were depending on attribute_names at the Record class level when we
only needed it at the instance level. Also, since Records can be
instantiated with no attributes, we can effectively capture and memoize
the Record's identifying attributes to use for primary_keys from an
instance of the record.