/// <summary> /// Posts the save changes. /// </summary> /// <param name="dbContext">The database context.</param> public override void PostSaveChanges(Data.DbContext dbContext) { var rockContext = dbContext as RockContext; if (GroupHistoryChanges != null && GroupHistoryChanges.Any()) { HistoryService.SaveChanges(rockContext, typeof(Group), Rock.SystemGuid.Category.HISTORY_GROUP_CHANGES.AsGuid(), GroupId, GroupHistoryChanges, true, this.ModifiedByPersonAliasId); } // If this is a Group of type Family, update the ModifiedDateTime on the Persons that are members of this family (since one of their Addresses changed) int groupTypeIdFamily = GroupTypeCache.GetFamilyGroupType().Id; var groupService = new GroupService(rockContext); int groupTypeId = groupService.GetSelect(this.GroupId, s => s.GroupTypeId); if (groupTypeId == groupTypeIdFamily) { var currentDateTime = RockDateTime.Now; var qryPersonsToUpdate = new GroupMemberService(rockContext).Queryable().Where(a => a.GroupId == this.GroupId).Select(a => a.Person); rockContext.BulkUpdate(qryPersonsToUpdate, p => new Person { ModifiedDateTime = currentDateTime, ModifiedByPersonAliasId = this.ModifiedByPersonAliasId }); } base.PostSaveChanges(dbContext); }