public void SaveSync(ISync sync)
        {
            using (DatabaseContext context = CreateDatabaseContext())
            {
                TApiPropertyState existingState = context.ApiPropertyState.SingleOrDefault(x => x.ApplicationName == DataContext.LicenseSettings.ApplicationName);

                if (existingState == null)
                {
                    context.ApiPropertyState.Add(new TApiPropertyState
                    {
                        LastAccessed    = sync.LastAccessed.GetValueOrDefault(DateTime.Now),
                        ApplicationName = sync.ApplicationName,
                        IsRunning       = sync.IsRunning
                    });
                }
                else
                {
                    existingState.LastAccessed    = sync.LastAccessed.GetValueOrDefault(DateTime.Now);
                    existingState.ApplicationName = sync.ApplicationName;
                    existingState.IsRunning       = sync.IsRunning;
                }

                context.SaveChanges();
            }
        }
        public ISync ReadSync()
        {
            using (DatabaseContext context = CreateDatabaseContext())
            {
                TApiPropertyState state = context.ApiPropertyState.SingleOrDefault(x => x.ApplicationName == DataContext.LicenseSettings.ApplicationName);

                if (state == null)
                {
                    return(null);
                }

                return(new ApiPropertySync
                {
                    LastAccessed = state.LastAccessed,
                    ApplicationName = state.ApplicationName,
                    IsRunning = state.IsRunning
                });
            }
        }