public async Task <MaintenanceModel> Create(MaintenanceModel MaintenanceModel) { await ValidateMaintenanceIfExist(MaintenanceModel); var mappedEntity = ObjectMapper.Mapper.Map <Maintenance>(MaintenanceModel); if (mappedEntity == null) { throw new ApplicationException($"Entity could not be mapped."); } mappedEntity.CreateDate = DateTime.Now; mappedEntity.ModifyDate = DateTime.Now; mappedEntity.CreatedBy = 1; mappedEntity.ModifiedBy = 1; mappedEntity.IsDeleted = false; var newEntity = await _MaintenanceRepository.AddAsync(mappedEntity); _logger.LogInformation($"Entity successfully added - NetlogAppService"); var newMappedEntity = ObjectMapper.Mapper.Map <MaintenanceModel>(newEntity); return(newMappedEntity); }