/// <summary>
        /// Registers an object in this table.
        /// </summary>
        /// <param name="obj">The object to register</param>
        public void RegisterObject(DatabaseItem obj)
        {
            int objectId = Items.Count;

            if (AvailableIds.Count > 0)
            {
                objectId = AvailableIds.Dequeue();
            }
            obj.OnRegister(objectId);
            Items.Add(obj);
        }
        /// <summary>
        /// Removes an object from the table.
        /// </summary>
        /// <param name="id">The id of the object to remove</param>
        /// <returns>The item that was removed.</returns>
        public DatabaseItem RemoveObject(int id)
        {
            DatabaseItem item = GetObject(id);

            if (item == null)
            {
                throw new KeyNotFoundException($"Could not remove Item({id}) from \'{Name}\' because it doesn\'t exist");
            }
            Items.RemoveAt(item.Id);
            AvailableIds.Enqueue(item.Id);
            item.OnUnregister();
            return(item);
        }