Fix datastore issues.

Details at https://github.com/Karaage-Cluster/karaage/issues/234.

We need to filter these events so we only call add_account_to_project
and add_account_to_institute for project/institute that are in the
relevant machine categories. Or rather, we should only call
add_account_to_project and add_account_to_institute if both the account
and the institute belong to the same machine category.

It could be argued that it would have lead to a cleaner API (and maybe
more efficient) by making the caller to the datastore function do this
check, however, at the moment, this way is simpler.

Also:

*  If we add a ProjectQuota/InstituteQuota, we need call
   add_account_to_project and add_account_to_institute as appropriate,
   as we may have new accounts for this project.

*  If we delete a ProjectQuota/InstituteQuota, we need call
   remove_account_from_project and remove_account_from_institute as
   appropriate, as accounts may have disappeared from the project.

Change-Id: Ia27537141822eedfcb545295629a39d4113ef539