In the current code family studies added a listener to the PatientChangingEvent, and on any change to any member patient family permissions are updated.
This is extremely inefficient, since family permission update involves reading all member patient documents, merging their permissions and updating the family. In addition to that, during a family update, a bunch of patients may be updated, and for each one a permission update is fired, even though a final permission update is called at the end. This makes the history very weird (a bunch of permission changes - one for each patient involved - is followed by the actual change to the family and yet another permission change)
The fix is to run FamilyPermisisonUpdate ONLY when an actual permission change is happening