/// <summary>
 /// Add non-unique index to store.
 /// </summary>
 /// <param name="store">IndexedDb Store</param>
 /// <param name="name"></param>
 /// <returns>Given IndexedDbStore Instance</returns>
 public static IndexedDbStore AddIndex(this IndexedDbStore store, string name)
 {
     return(store.CreateIndex(name, new IndexedDbIndexParameter()
     {
         Unique = false
     }));
 }
        /// <summary>
        /// Adds Key and Indexes to Store based on IndexedDbKey and IndexedDbIndex Attributes on properties in Type T
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="store"></param>
        /// <returns></returns>
        public static IndexedDbStore SetupFrom <T>(this IndexedDbStore store)
        {
            store.Indexes = null;

            var type  = typeof(T);
            var props = type.GetProperties();

            foreach (var prop in props)
            {
                var keyAttribute   = prop.GetCustomAttribute <IndexDbKeyAttribute>();
                var indexAttribute = prop.GetCustomAttribute <IndexDbIndexAttribute>();

                if (keyAttribute is not null)
                {
                    store.CreateKey(prop.Name, keyAttribute.AutoIncrement);
                    store.CreateIndex(prop.Name, new IndexedDbIndexParameter()
                    {
                        Unique = keyAttribute.Unique
                    });
                }

                if (indexAttribute is not null)
                {
                    store.CreateIndex(prop.Name, new IndexedDbIndexParameter()
                    {
                        Unique = indexAttribute.Unique
                    });
                }
            }

            if (store.Key == null)
            {
                throw new System.Exception($"No IndexDbKey Found on Property Attributes in Class {type.Name}");
            }

            return(store);
        }