public async Task <bool> AddLogEntry(SyncLogEntry log)
        {
            var siteId = User.Identity.GetClaim(CustomClaimTypes.SiteId);

            log.RemoteSiteID = siteId;
            return(await SyncLogEntryUtil.AddLog(log));
        }
        public static void WriteToSyncLog(string source, string detail, EventLogEntryType errorType, Exception ex = null)
        {
            var status = errorType.ToString();

            if (ex != null)
            {
                detail += GetFormattedException(ex);
            }

            var log = new SyncLogEntry
            {
                Detail    = detail,
                Source    = source,
                ErrorType = status
            };

            bool res  = false;
            var  task = Task.Run(async() => {
                res = await SyncLogEntryUtil.AddLog(log);
            });

            task.Wait();
        }