private void OnPanelRemovalRequested(string name, string url, string repoPath)
        {
            EditorUtility.DisplayProgressBar("Removing Repository", $"Removing {name} and re-importing" + GUIUtility.GetLoadingDots(), (float)EditorApplication.timeSinceStartup % 1);

            for (int i = 0; i < _dependencies.Dependencies.Count; i++)
            {
                if (_dependencies.Dependencies[i].Name == name)
                {
                    GUIRepositoryPanel panel = _repoPanels.Find(p => _dependencies.Dependencies[i].Name == p.DependencyInfo.Name);
                    _dependencies.Dependencies.RemoveAt(i);
                    Repository.Remove(url, repoPath);
                }
            }

            //TODO: if we could referesh a folder only that would be nice. cant reimport assets that dont exists.
            AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);

            UpdateDependencies(_dependencies.Dependencies);

            EditorUtility.ClearProgressBar();
        }
        private void UpdateDependencies(List <Dependency> updatedDependencies = null)
        {
            _repoPath             = Path.Combine(Application.dataPath, "Repositories");
            _rootDependenciesFile = Path.Combine(_repoPath, "Dependencies.json");

            //Ensure to create directory structure and default dependencies if nothing exists
            Directory.CreateDirectory(_repoPath);
            if (!File.Exists(_rootDependenciesFile))
            {
                File.WriteAllText(_rootDependenciesFile, JsonUtility.ToJson(new DependencyInfo(), true));
            }
            string json = File.ReadAllText(_rootDependenciesFile);

            _dependencies = JsonUtility.FromJson <DependencyInfo>(json);

            //Sync file dependencies with in memory dependencies
            if (updatedDependencies != null)
            {
                //Remove no longer existing
                for (int i = _dependencies.Dependencies.Count - 1; i >= 0; i--)
                {
                    var dep = _dependencies.Dependencies[i];
                    if (updatedDependencies.FindAll(d => d.Name == dep.Name).Count <= 0)
                    {
                        _dependencies.Dependencies.RemoveAt(i);
                    }
                }

                //Add new
                foreach (var dep in updatedDependencies)
                {
                    if (_dependencies.Dependencies.FindAll(d => d.Name == dep.Name).Count <= 0)
                    {
                        _dependencies.Dependencies.Add(dep);
                    }
                }

                json = JsonUtility.ToJson(_dependencies, true);
                File.WriteAllText(_rootDependenciesFile, json);
            }

            //Update repo panels
            _repoPanels = new List <GUIRepositoryPanel>();
            foreach (Dependency dependency in _dependencies.Dependencies)
            {
                if (_repoPanels.FindAll(p => dependency.Name == p.DependencyInfo.Name).Count == 0)
                {
                    GUIRepositoryPanel panel = new  GUIRepositoryPanel(dependency, _editIcon, _removeIcon, _pushIcon, _pullIcon);
                    panel.OnRemovalRequested += OnPanelRemovalRequested;
                    panel.OnRefreshRequested += (updatedRepos) =>
                    {
                        UpdateAssetDatabase();
                    };
                    panel.OnEditRequested    += OnPanelEditRequested;
                    panel.OnRepaintRequested += Repaint;
                    _repoPanels.Add(panel);
                }
            }

            //update git status, used to determine if changes are present
            foreach (GUIRepositoryPanel panel in _repoPanels)
            {
                panel.UpdateStatus();
            }

            Repaint();
        }