static DeviceBatchAssignedUsersManagedGroup()
{
RepositoryEvents =
new Lazy<IObservable<RepositoryMonitorEvent>>(() =>
RepositoryMonitor.StreamBeforeCommit.Where(e =>
e.EntityType == typeof(Device) && (
(e.EventType == RepositoryMonitorEventType.Added &&
((Device)e.Entity).AssignedUserId != null) ||
(e.EventType == RepositoryMonitorEventType.Modified &&
(e.ModifiedProperties.Contains("DeviceBatchId") || e.ModifiedProperties.Contains("AssignedUserId"))) ||
(e.EventType == RepositoryMonitorEventType.Deleted &&
((Device)e.Entity).AssignedUserId != null))
)
);
}