public void ProcessApiRequestAsync(MailApiCall apiMethod, string apiKey, string apiValue = null, string json = null, int status = 0, DateTime?processed = default(DateTime?), DateTime?completed = default(DateTime?), bool shortLived = true) { try { var m = _contentManager.New <MailApiPart>("MailApi"); m.Status = status; m.Processed = DateTime.UtcNow; m.ApiKey = apiKey; m.ApiValue = apiValue; m.Json = json; m.ApiMethod = EnumHelper.EnumToString(apiMethod); _contentManager.Create(m); if (!shortLived) { _concurrentTasks.ExecuteAsyncTask(ProcessApiRequest, m.ContentItem); } else { _taskManager.MailApiAsync(m.ContentItem); } } catch (Exception ex) { Logger.Debug(ex, string.Format("Failed Mail Api Request.\n\nKey:\n{0}\n\nValue:\n{1}\n\nJson:\n{2}\n\n", apiMethod, apiKey, apiValue, json)); } }