internal static void Delete(Type objectType, object criteria) { var dp = new DataPortal <object>(); try { var task = dp.DoDeleteAsync(objectType, criteria, true); if (!task.IsCompleted) { task.RunSynchronously(); } if (task.Exception != null) { throw task.Exception; } } catch (AggregateException ex) { if (ex.InnerExceptions.Count > 0) { throw ex.InnerExceptions[0]; } else { throw; } } }