public async Task <int> SaveBuildingHotSpot(HotSpotView dto) { var info = _repository.FirstOrDefault( x => x.HotspotName == dto.HotspotName && x.InfrastructureType == InfrastructureType.HotSpot); if (info == null) { info = dto.MapTo <InfrastructureInfo>(); info.InfrastructureType = InfrastructureType.HotSpot; await _repository.InsertAsync(info); } else { dto.MapTo(info); } return(_repository.SaveChanges()); }