Entity Framework Crear nuevas filas de datos durante db.SaveChanges ()

Crear una aplicación AngularJS basada en este tutorial:http://jphoward.wordpress.com/2013/01/04/end-to-end-web-app-in-under-an-hour/

Clases

public class Todo
{
    public int ID { get; set; }
    public virtual Status Status { get; set; }
}

public class Status
{
    public int ID { get; set; }
    public string Type { get; set; }
}

La funcionalidad es que haces clic en un botón y cambia el estado. Cuando se hace clic en el botón, todas las cosas correctas se pasan a Visual Studio. Originalmente no se actualizaba en absoluto. Después de un poco de investigación, encontré algunas formas de forzar los cambios, pero luego en db.SaveChanges () agrega una nueva fila al Estado que tiene el mismo 'Tipo', solo una ID incrementada de lo que sea en el último.

JS que llama a la actualización:

Api.Todo.update({ id: todoID }, todo, function () {
    $location.path('/');
});

Que golpea VS en esta función:

private DataContext db = new DataContext();

// PUT api/Todo/5
HttpResponseMessage PutTodo(int id, Todo todo)
{
    if (!ModelState.IsValid)
    {
        return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
    }

    if (id != todo.ID)
    {
        return Request.CreateResponse(HttpStatusCode.BadRequest);
    }

    // Found a stack overflow that mentioned that you need to check for things already being tracked
    var entry = db.Entry(todo);

    if (entry.State == EntityState.Detached)
    {
        var set = db.Set<Todo>();
        Todo attachedEntity = set.Find(todo.ID);  // You need to have access to key
        if (attachedEntity != null)
        {
            // The following code does not update any changes to the foreign keys
            var attachedEntry = db.Entry(attachedEntity);
            attachedEntry.CurrentValues.SetValues(todo);
            db.Entry(attachedEntity).State = EntityState.Modified;

            // When this didn't work, I tried just changing the status on the already attached entity
            //attachedEntity.Status = todo.Status;
            //db.SaveChanges();
            // However when it hit SaveChanges() it created a new row in the Status table.
        }
        else
        {
            //This code was never hit
            entry.State = EntityState.Modified; // This should attach entity
        }
    }

    try
    {
        db.SaveChanges();
    }
    catch (DbUpdateConcurrencyException ex)
    {
        return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
    }

Me estoy acercando al final de mis capacidades y me encantaría un poco de ayuda o dirección.

Respuestas a la pregunta(1)

Su respuesta a la pregunta