public void Save(CaseLogEntry log) { if (ModelState.IsValid) { if (log.Id == 0) { _context.AddLogEntry(log); } else { _context.UpdateLogEntry(log); } } }