Can't save CalendarEvents with a user id?


I’m evaluating your scheduler product for potential purchase but I’m having trouble saving CalendarEvents with a user. If I don’t set the user, my controller saves the CalendarEvent without issue, if I do set the user, my controller stops at data.CalendarEvents.Add(CalendarEvent), I’ve tried both async and non-threaded methods. Update and delete also hang on their respective context.action methods. Any ideas?

Here is my controller code:

[code]public ContentResult Save(CalendarEvent updatedEvent, FormCollection formData)
var action = new DataAction(formData);
var context = new CPDbContext();

            var currentUser = manager.FindById(User.Identity.GetUserId());
            switch (action.Type)
                case DataActionTypes.Insert: //insert case
                    //if (ModelState.IsValid)
                    if( == 0)

                        context.Entry(updatedEvent).State = EntityState.Modified;
                    updatedEvent.ApplicationUser = currentUser;

                    if (!ModelState.IsValid)
                        var errors = ModelState.SelectMany(x => x.Value.Errors.Select(z => z.Exception));

                        // Breakpoint, Log or examine the list with Exceptions.
                case DataActionTypes.Delete: //delete case
                    updatedEvent = context.CalendarEvents.SingleOrDefault(ev => ==;
                default: //update case 
                    updatedEvent.ApplicationUser = currentUser;
                    updatedEvent = context.CalendarEvents.SingleOrDefault(
                        ev => ==;
            Console.Write("Getting it");
            action.TargetId =;
        catch (Exception e)
            action.Type = DataActionTypes.Error;

        return Content(new AjaxSaveResponse(action));

And this is my CalendarEvent class:

[code]public class CalendarEvent
//id, text, start_date and end_date properties are mandatory
public int id { get; set; }
public string text { get; set; }
public DateTime start_date { get; set; }
public DateTime end_date { get; set; }

    public virtual ApplicationUser ApplicationUser { get; set; }

I just tried setting up another controller and save works perfectly with this code:

[code]// POST: /CalendarEvent/Create
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see
public async Task Create([Bind(Include=“id,text,start_date,end_date”)] CalendarEvent calendarevent)
var currentUser = await manager.FindByIdAsync(User.Identity.GetUserId());
if (ModelState.IsValid)
calendarevent.ApplicationUser = currentUser;
await db.SaveChangesAsync();
return RedirectToAction(“Index”);

        return View(calendarevent);

What would cause the calendar controller to function so differently? It’s fundamentally the same thing?

Was there an exception during saving? If so, what was the error message?