/// <inheritdoc/>
        public void Restore(string pathToProjectFile, string[] packageSources)
        {
            var projectFile             = new ProjectFile(File.ReadAllText(pathToProjectFile));
            var pathToCachedProjectFile = $"{pathToProjectFile}.cache";

            if (File.Exists(pathToCachedProjectFile))
            {
                _logger.Debug($"Found cached csproj file at: {pathToCachedProjectFile}");
                var cachedProjectFile = new ProjectFile(File.ReadAllText(pathToCachedProjectFile));
                if (projectFile.Equals(cachedProjectFile))
                {
                    _logger.Debug($"Skipping restore. {pathToProjectFile} and {pathToCachedProjectFile} are identical.");
                    return;
                }
                else
                {
                    _logger.Debug($"Cache miss. Deleting stale cache file {pathToCachedProjectFile}");
                    File.Delete(pathToCachedProjectFile);
                    RestoreAndCacheProjectFile();
                }
            }
            else
            {
                RestoreAndCacheProjectFile();
            }

            void RestoreAndCacheProjectFile()
            {
                _restorer.Restore(pathToProjectFile, packageSources);
                if (projectFile.IsCacheable)
                {
                    _logger.Debug($"Caching project file : {pathToCachedProjectFile}");
                    projectFile.Save(pathToCachedProjectFile);
                }
                else
                {
                    _logger.Warning($"Unable to cache {pathToProjectFile}. For caching and optimal performance, ensure that the script(s) references Nuget packages with a pinned version.");
                }
            }
        }