private DateTime GetAndResetLastRunTime()
        {
            DateTime?lastUpdatedUtcDate = null;

            try
            {
                Status syncStatus;

                if (ProfileSyncController.GetLastRunTime(InternalProviderId, out lastUpdatedUtcDate, out syncStatus) && syncStatus == Status.Succeeded)
                {
                    ProfileSyncController.ResetLastRunTime(InternalProviderId, Status.InProgress);
                }
                else
                {
                    ProfileSyncController.SetLastRunStatus(InternalProviderId, Status.InProgress);
                }
            }
            catch (Exception)
            {
                SPLog.Event("Cound not get last Profile Incremental Sync time, using default.");
            }

            return(lastUpdatedUtcDate ?? DefaultLastRunTime());
        }
 private void UpdateLastRunStatus(Status syncStatus)
 {
     ProfileSyncController.ResetLastRunTime(InternalProviderId, syncStatus);
 }