public static void UpdateMessage(SimplifiedMessage message) { using (var context = new versioningEntities()) { context.SimplifiedMessages.Attach(message); context.Entry(message).State = EntityState.Modified; try { context.SaveChanges(); } catch (DbUpdateConcurrencyException updateConcurrencyException) { var ex = new ConcurrencyException("Update failed.", updateConcurrencyException); throw ex; } } }