title: Get the last inserted item using Document Model or Object Persistence Model using .Net core with DynamoDB
body: <p>I am able to get the last inserted item using low level API as showed in code below using .net core</p>
  
  <p>But is it possible to get the last inserted item using high level API such as <strong>Document Model</strong> or <strong>Object Persistence Model</strong>?</p>
  
  <p>Prefer <strong>Object Persistence Model</strong> if possible.  I am not able to find a way to do it, also, I would like DynamoDB to query and return the last item only.  I understand that I can get a list of items inserted and get the last item myself in memory, but it is not preferable since it require a lot more read and data transfer.</p>
  
  <p>Thanks  </p>
  
  <pre><code>public async Task&lt;DailyStockRecordDao&gt; GetTheLastInsertedItem(string tickerSymbol)
  {
      QueryRequest request = getTheLastItemRequest(tickerSymbol);
  
      var response = await _dynamoDBClient.QueryAsync(request);
  
      return null;
  
  }
  
  private static QueryRequest getTheLastItemRequest(string tickerSymbol)
  {
      string partitionName = ":v_PartitionKeyName";
      var request = new QueryRequest
      {
          TableName = Constants.TableName,
          KeyConditionExpression = $"{Constants.PartitionKeyName} = {partitionName}",
          ExpressionAttributeValues = new Dictionary&lt;string, AttributeValue&gt; {
              { $"{partitionName}", new AttributeValue {
                  S = tickerSymbol
              } }
          },
          // Optional parameter.
          ConsistentRead = false,
          Limit = 1,
          ExclusiveStartKey = null,
          ScanIndexForward = false
      };
      return request;
  }
  </code></pre>