private void CreateAlarmLog(SendAlertModel sam) { AlarmSystem.Core.Entity.Dto.Alarm alarm = _alarmService.GetAlarmByCode(sam.AlarmCode); AlarmSystem.Core.Entity.Dto.Machine machine = _machineService.GetMachineById(sam.MachineId); var date = DateTime.UtcNow; long epochOfNow = new DateTimeOffset(date).ToUnixTimeMilliseconds(); AlarmSystem.Core.Entity.Dto.AlarmLog al = new AlarmSystem.Core.Entity.Dto.AlarmLog() { Alarm = alarm, Machine = machine, Date = epochOfNow }; _alarmLogService.CreateAlarmLog(al); }