title: KnockoutJS: Dynamically Insert in a nested observable array by a value of a Key
body: <p>I have JSON Object which looks like this:</p>
  
  <pre><code>Data: {
      MembershipName:
      Countries: {
                  CountryName: "USA"
                  States:
                                  {
                                    State: "Alabama"
                                         {
                                            Members: {}
                                         } 
                                  }
         }
  }
  </code></pre>
  
  <p>I wanted to insert inside the "State" observable array with the CountryName "USA".</p>
  
  <p>Right now, I can insert to Countries by:</p>
  
  <pre><code>self.Data()[$index].Countries.push(
              new countryViewModel(
                  {
                      'CountryName': self.SelectedCountry()
                  }
              )
          );
  </code></pre>
  
  <p>But what if instead of using $index, I wanted to insert depending on the value of one of the keys in that array? For this example is WHERE "CountryName" is "USA"?</p>