private void DeleteObsoleteTypes()
        {
            var pluginClasses = AssemblyHelper.GetClasses <IPlugin>();
            var wfClasses     = AssemblyHelper.GetClasses <CodeActivity>();

            var existingTypes = CrmAssemblyHelper.GetCrmTypes(Id, Context);

            var nonExistentTypes = existingTypes
                                   .Where(pluginType => !pluginClasses.Contains(pluginType.TypeName) &&
                                          !wfClasses.Contains(pluginType.TypeName)).ToList();

            // delete non-existing types
            if (nonExistentTypes.Any())
            {
                if (DteHelper.IsConfirmed("Please confirm that you want to DELETE non-existent types in this assembly." +
                                          " This means that all its steps will be deleted!", "Type deletion"))
                {
                    UpdateStatus("Deleting non-existent types ... ", 1);

                    nonExistentTypes.ForEach(pluginType => DeleteTree(pluginType.Id,
                                                                      Dependency.Enums.RequiredComponentType.PluginType));

                    UpdateStatus("Finished deleting non-existent types.", -1);
                }
                else
                {
                    throw new Exception("Can't update assembly with obsolete types in the system.");
                }
            }
        }
        private List <string> GetExistingTypeNames()
        {
            var existingTypeNames = CrmAssemblyHelper.GetCrmTypes(Id, Context)
                                    .Select(type => type.TypeName).ToList();

            return(existingTypeNames);
        }