public void SyncDatabaseInBackground(PlayServicesManager playServicesManager)
        {
            if(null == playServicesManager || !playServicesManager.IsConnected) {
                return;
            }

            Logger.Info("Starting database sync task...");
            Task.Run(async () => {
                PlayServicesManifest localManifest = await ReadLocalManifest().ConfigureAwait(false);
                if(null == localManifest) {
                    localManifest = new PlayServicesManifest();
                    await WriteLocalManifset(localManifest).ConfigureAwait(false);
                }
    
                PlayServicesManifest remoteManifest = await ReadRemoteManifest().ConfigureAwait(false);
                if(null == remoteManifest) {
                    remoteManifest = new PlayServicesManifest();
                    await WriteRemoteManifestFile(playServicesManager).ConfigureAwait(false);
                }

                if(ShouldPull(localManifest)) {
                    await PullDatabaseFile(playServicesManager).ConfigureAwait(false);
                } else if(ShouldPush(localManifest, remoteManifest)) {
                    await PushDatabaseFile(playServicesManager).ConfigureAwait(false);
                } else {
                    SyncConflictAction conflictResolutionAction = await GetConflictResolutionAction().ConfigureAwait(false);
                    switch(conflictResolutionAction)
                    {
                    case SyncConflictAction.Push:
                        await PushDatabaseFile(playServicesManager).ConfigureAwait(false);
                        break;
                    case SyncConflictAction.Pull:
                        await PullDatabaseFile(playServicesManager).ConfigureAwait(false);
                        break;
                    }
                }

                Logger.Info("Database sync task complete!");
            });
        }
        protected override async Task WriteLocalManifset(PlayServicesManifest localManifest)
        {
await Task.Delay(0).ConfigureAwait(false);
        }
        private async Task WriteRemoteManifestFile(PlayServicesManager playServicesManager)
        {
            using(Stream stream = new MemoryStream()) {
                PlayServicesManifest manifest = new PlayServicesManifest();
                await manifest.Write(stream).ConfigureAwait(false);
                await stream.FlushAsync().ConfigureAwait(false);

                stream.Position = 0;
                await playServicesManager.SaveFileToDriveAppFolderAsync(PlayServicesManifest.FileTitle, PlayServicesManifest.ContentType, stream).ConfigureAwait(false);
            }
        }
 protected abstract Task WriteLocalManifset(PlayServicesManifest localManifest);
 private static bool ShouldPush(PlayServicesManifest localManifest, PlayServicesManifest remoteManifest)
 {
     return !ShouldPull(localManifest) && remoteManifest.LastSyncTimestampSeconds < localManifest.LastSyncTimestampSeconds;
 }
 private static bool ShouldPull(PlayServicesManifest localManifest)
 {
     return localManifest.LastUpdateTimestampSeconds < localManifest.LastSyncTimestampSeconds;
 }