Add instance to scope for custom attributes. This gets the correct set of custom_attribute_definitions. When creating an Audit while on the Program page "instance" was a Program and the custom_attribute_definitions that were coming back were the CADs associated with Program. They needed to be the CADs associated with Audit. Passing the instance into the scope solved this problem.
The logic in this method should set attributes as we need them. The context_id will be set to the same context_id as the attributable object to which they belong. This will allow RBAC rules set on the attributable object to be used also for the attributes.

This code isn't currently working though. I haven't been able to get the Python code to execute this function. The JSON passed into the PUT call has two elements "custom_attribute_values", which is empty and "custom_attributes", which contains the dictionary using the encoding that Anze specified. The python code in the method in this PR attempts to unpack the dictionary to flush and reset the attribute values from that dictionary. But I haven't been able to configure the SQLAlchemy mappings properly in order to get this method to execute.
Saving custom attributes on PUT

POST doesn't work because at the time custom_attributes method is run,
cls.id has not yet been set. I've also disabled saving custom attribute
values in record builder, because obj.custom_attribute_definition is
not defined.
Saving custom attributes on POST

Not the cleanest solution (attributable_id first gets saved as NULL and
then updated), but it seems to be working.

I wonder if making using POST/PUT events for saving custom_attribute
values would be cleaner than this.
Some code cleanup
Merge pull request #2078 from reciprocity/feature/save-custom-attributes

Feature/save custom attributes