public void ResetOnFilter()
        {
            prevImageSelected = null;
            foreach (ImageCellAttribute c in Cells)
            {
                c.isSelected = false;
            }
            //clear all selected cells
            if (mainCollectionView != null)
            {
                if (prevCell != null)
                {
                    prevCell.ImageView.Layer.BorderColor   = UIColor.Gray.CGColor;
                    prevCell.ImageView.Layer.BorderWidth   = 1f;
                    prevCell.ImageView.Layer.CornerRadius  = 5f;
                    prevCell.ImageView.Layer.MasksToBounds = true;
                    prevCell = null;
                }

                /*
                 * foreach (NSIndexPath path in SelectedImagesToClear)
                 * {
                 *      var cell = (UserCellAttribute)mainCollectionView.CellForItem(path);
                 *      if (cell != null)
                 *      {
                 *              cell.ImageView.Layer.BorderColor = UIColor.Gray.CGColor;
                 *              cell.ImageView.Layer.BorderWidth = 1f;
                 *              cell.ImageView.Layer.CornerRadius = 5f;
                 *              cell.ImageView.Layer.MasksToBounds = true;
                 *      }
                 * }*/
            }
        }
        public override void ItemHighlighted(UICollectionView collectionView, NSIndexPath indexPath)
        {
            /*
             * Fix this when switching attributes
             */

            var cell = (UserCellAttribute)collectionView.CellForItem(indexPath);
            ImageCellAttribute Clicked = Cells[indexPath.Row];

            SelectedImagesToClear.Add(indexPath);
            if (mainCollectionView == null)
            {
                mainCollectionView = collectionView;
            }

            /*
             * Select/Deselect Images and keep them Highlighted
             */
            if (isAttributesTab)
            {
                //unclick the previous image
                if (prevImageSelected != null && prevImageSelected != indexPath)
                {
                    Cells[prevImageSelected.Row].isSelected = false;
                    prevCell.ImageView.Layer.BorderColor    = UIColor.Gray.CGColor;
                    prevCell.ImageView.Layer.BorderWidth    = 1f;
                    prevCell.ImageView.Layer.CornerRadius   = 5f;
                    prevCell.ImageView.Layer.MasksToBounds  = true;
                    //prevCell.ImageView.Alpha = 1.0f;
                }


                //always highlight the currently selected image
                //cell.ImageView.Alpha = 0.5f;
                cell.ImageView.Layer.BorderColor   = AppColors.PEACH.CGColor;
                cell.ImageView.Layer.BorderWidth   = 10f;
                cell.ImageView.Layer.CornerRadius  = 5f;
                cell.ImageView.Layer.MasksToBounds = true;
                Cells[indexPath.Row].isSelected    = true;
                prevCell = (UserCellAttribute)collectionView.CellForItem(indexPath);
            }

            /*
             * Image Stacks functionality. This adds Selected images to the array
             * to be able to delete images from this image stack.
             */
            else
            {
                if (Clicked.isSelected)
                {
                    cell.ImageView.Layer.BorderColor   = UIColor.Gray.CGColor;
                    cell.ImageView.Layer.BorderWidth   = 1f;
                    cell.ImageView.Layer.CornerRadius  = 5f;
                    cell.ImageView.Layer.MasksToBounds = true;
                    //cell.ImageView.Alpha = 1.0f;
                    Clicked.isSelected = false;
                    //remove the object from the list
                    SelectedImagesToImageStack.Remove(Clicked.ImgOBJ);
                }
                else
                {
                    cell.ImageView.Layer.BorderColor   = AppColors.PEACH.CGColor;
                    cell.ImageView.Layer.BorderWidth   = 10f;
                    cell.ImageView.Layer.CornerRadius  = 5f;
                    cell.ImageView.Layer.MasksToBounds = true;
                    //cell.ImageView.Alpha = 0.5f;
                    Clicked.isSelected = true;
                    //add the image object to the list
                    SelectedImagesToImageStack.Add(Clicked.ImgOBJ);
                }
            }
            prevImageSelected = indexPath;
        }