public async void GenerateEventForUnRegistrationUser() { var dateOfLastCheckedRegistrationUser = await settingsRepository.GetLastRegistrationSettings(); var users = await userRepository.GetAllAsync(); foreach (var user in users) { if (dateOfLastCheckedRegistrationUser == null || user.RegisteredAt.CompareTo(dateOfLastCheckedRegistrationUser.DateOfLastNotificationUser) > 0) { var registrationEventInfo = new RegistrationEventInfo() { Email = user.Email, FirstName = user.FirstName, LastName = user.LastName, RegisteredAt = user.RegisteredAt, IsChecked = false }; await registrationEventInfoRepository.CreateRegistrationEventInfoAsync(registrationEventInfo); var settingOfEventsRegistration = new SettingsEventOfRegistration() { DateOfLastNotificationUser = user.RegisteredAt }; await settingsRepository.CreateRegistrationEventSettingsAsync(settingOfEventsRegistration); } } }