title: Save data to local storage using Room
body: <p>I apologize in advance if the question seems incomprehensible, since android development and kotlin are not my main stack. I will try to explain in as clear a language as possible.</p>
  <p>I have a class that is responsible for intercepting data from HTTP-request. This implementation reflects the following code</p>
  <pre><code>    class PocketScoutInterceptor() : Interceptor {
  
  
      fun buildPacket(timestamp: Long, duration: Double, request: Request, response: Response) {
          val reqBody = request.body
          val respBody = response.body?.string()
  
          val packet = Packet(
              id = 0,
              userId = PocketScoutConfig.userId,
              deviceId = PocketScoutConfig.deviceId,
              sessionId = PocketScoutConfig.sessionId,
              timestamp = timestamp,
              duration = duration.roundToInt(),
              protocol = &quot;http&quot;,
              request = room.entities.Request(
                  request_method = request.method,
                  request_url = request.url.toUrl().toString(),
                  request_headers = request.headers.toMultimap() as Mapping,
                  request_body = (reqBody?.toString() ?: &quot;&quot;),
                  request_size = (reqBody?.toString()?.length ?: 0),
              ),
              room.entities.Response(
                  response_code = response.code,
                  response_headers = response.headers.toMultimap() as Mapping,
                  response_body = (respBody ?: &quot;&quot;),
                  response_size = (respBody?.length ?: 0),
              )
          )
      }
  }
  </code></pre>
  <p>Further, I need to save this data in a local database, I chose room.</p>
  <p>Next I created a database class</p>
  <pre><code>    @TypeConverters(value = [RoomTypeConverters::class])
  @Database(
      version = 1,
      entities = [Packet::class],
      exportSchema = false
  )
  abstract class NetworkDatabase : RoomDatabase() {
      abstract fun packetDao(): PacketDao
  }
  </code></pre>
  <p>I just have to learn how to save data in local storage. I've watched several videos on this topic and read the documentation several times, but as far as my example is concerned, I can't find an answer. Maybe you can help me</p>