title: Sequence contains more than one element error in EF CF Migrations
body: <p>I created some models, added the migration and then did an update database operation, though at my last update database operation I got the error message saying: </p>
  
  <blockquote>
    <p>Sequence contains more than one element</p>
  </blockquote>
  
  <p>Below you can find my migration configuration:</p>
  
  <pre><code>context.Categories.AddOrUpdate(p =&gt; p.CategoryName,
      new Category
      {
          CategoryName = "Sport"
      },
      new Category
      {
          CategoryName = "Music"
      }
  );
  
  context.Subcategories.AddOrUpdate(p =&gt; p.SubcategoryName,
      new Subcategory
      {
          SubcategoryName = "Football"
      },
      new Subcategory
      {
          SubcategoryName = "Basketball"
      },
      new Subcategory
      {
          SubcategoryName = "Piano"
      },
      new Subcategory
      {
          SubcategoryName = "Violin"
      }
  );
  
  context.Services.AddOrUpdate(p =&gt; p.ServiceType,
      new Service
      {
          ServiceType = "Football player",
          Category = { CategoryName = "Sport" },
          Subcategory = { SubcategoryName = "Football" }
      },
      new Service 
      {
          ServiceType = "Piano lessons",
          Category = { CategoryName = "Music" },
          Subcategory = { SubcategoryName = "Piano" }
      }
  );
  </code></pre>
  
  <p>The problem occurs with when I add new Services. I already have categories and subcategories, and if I do like <code>Category = new Category { CategoryName = "Music" }</code> then it works but I get Music entry twice in my database (for this example). I want to use the already added categories and subcategories. Below also you can find my models definitions.</p>
  
  <pre><code>public class Category
  {
      [Key]
      public int CategoryID { get; set; }
  
      public string CategoryName { get; set; }
  }
  
  // Subcategory is defined the same way...
  
  public class Service
  {
      public int ServiceID { get; set; }
  
      public string ServiceType { get; set; }
  
      public virtual Category Category { get; set; }
  
      public virtual Subcategory Subcategory { get; set; }
  
  }
  </code></pre>
  
  <p>Any idea how to solve it?</p>