/// <summary> /// Called after saving of the specified enumeration of entities has taken place. /// </summary> /// <param name="entities">The entities.</param> /// <param name="state">The state passed between the before save and after save callbacks.</param> public void OnAfterSave(IEnumerable <IEntity> entities, IDictionary <string, object> state) { foreach (long entityId in entities.Select(e => e.Id)) { _auditLogEventTarget.WriteSaveAuditLogEntries(true, entityId, state); } var newTenantTempIds = (List <long>)state[NewTenantKey]; Database.DatabaseContext.GetContext().AddPostDisposeAction(() => { foreach (var tempId in newTenantTempIds) { var tenantId = EventTargetStateHelper.GetIdFromTemporaryId(state, tempId); TenantHelper.NotifyTenantCreate(tenantId); } }); }