private static List <RenamePreview> GetPreviewsWithDuplicateNames(IList <RenamePreview> previews, AssetCache assetCache)
        {
            var assetPreviews = new List <RenamePreview>();

            for (int i = 0; i < previews.Count; ++i)
            {
                var previewForObject = previews[i];
                if (previewForObject.ObjectToRename.IsAsset())
                {
                    assetPreviews.Add(previewForObject);
                }
            }

            // Get all the cached file paths, but remove any that are in the preview
            // because those names could be different. We want to test that NEW names
            // don't collide with existing assets.
            HashSet <string> allFinalFilePaths = assetCache.GetAllPathsHashed();

            foreach (var assetPreview in assetPreviews)
            {
                allFinalFilePaths.Remove(assetPreview.OriginalPathToSubAsset);
            }

            // Now hash the new names and check if they collide with the existing assets
            var problemPreviews        = new List <RenamePreview>();
            var unchangedAssetPreviews = new List <RenamePreview>();
            var changedAssetPreviews   = new List <RenamePreview>();

            // Separate unchangedAssets from changedAsests
            foreach (var assetPreview in assetPreviews)
            {
                var thisObject = assetPreview.ObjectToRename;
                var thisResult = assetPreview.RenameResultSequence;
                if (thisResult.NewName == thisResult.OriginalName)
                {
                    unchangedAssetPreviews.Add(assetPreview);
                }
                else
                {
                    changedAssetPreviews.Add(assetPreview);
                }
            }

            // First add all the unchanged results, so that we collide on the
            // first time adding new names. This fixes an issue where
            // you'd rename one object which now matches a second, but the second gets
            // the warning instead of the first.
            var previewsSorted = new List <RenamePreview>();

            previewsSorted.AddRange(unchangedAssetPreviews);
            previewsSorted.AddRange(changedAssetPreviews);
            foreach (var renamePreview in previewsSorted)
            {
                var resultingPath = renamePreview.GetResultingPath();
                if (allFinalFilePaths.Contains(resultingPath))
                {
                    problemPreviews.Add(renamePreview);
                }
                else
                {
                    allFinalFilePaths.Add(resultingPath);
                }
            }

            return(problemPreviews);
        }