public static void ConfirmAttached(this XrmServiceContext context, Entity entity)
 {
     try
     {
         context.ReAttach(entity);
     }
     catch
     {
         try
         {
             context.Attach(entity);
         }
         catch
         {
             // ignored
         }
     }
 }