/***************************************************/

        public int GetHashCode(T obj)
        {
            if (typeof(IBHoMObject).IsAssignableFrom(typeof(T)))
            {
                IBHoMObject  bHoMObject   = (IBHoMObject)obj;
                HashFragment hashFragment = bHoMObject.GetHashFragment();
                if (!string.IsNullOrWhiteSpace(hashFragment?.CurrentHash))
                {
                    return(hashFragment.CurrentHash.GetHashCode());
                }
            }

            return(obj.DiffingHash(DiffConfig).GetHashCode());
        }
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public bool Equals(T x, T y)
        {
            if (x?.GetType() == y?.GetType())
            {
                string xHash = null;
                string yHash = null;

                IBHoMObject xbHoM = x as IBHoMObject;
                IBHoMObject ybHoM = y as IBHoMObject;

                if (xbHoM != null && ybHoM != null)
                {
                    xHash = xbHoM?.GetHashFragment()?.CurrentHash;
                    yHash = ybHoM?.GetHashFragment()?.CurrentHash;

                    if (string.IsNullOrWhiteSpace(xHash))
                    {
                        xHash = x.DiffingHash(DiffConfig);

                        if (StoreHash)
                        {
                            SetHashFragment(xbHoM, xHash);
                        }
                    }

                    if (string.IsNullOrWhiteSpace(yHash))
                    {
                        yHash = y.DiffingHash(DiffConfig);

                        if (StoreHash)
                        {
                            SetHashFragment(ybHoM, yHash);
                        }
                    }

                    return(xHash == yHash);
                }


                return(x.DiffingHash(DiffConfig) == y.DiffingHash(DiffConfig));
            }

            return(false);
        }
        /***************************************************/

        // Modify in-place.
        private static bool SetHashFragment(IBHoMObject obj, string hash)
        {
            HashFragment existingFragm = obj.GetHashFragment();

            return(obj.Fragments.AddOrReplace(new HashFragment(hash, existingFragm?.CurrentHash)));
        }