/// <summary>
        ///     Loads the database.
        /// </summary>
        public void Load()
        {
            _cache.Clear();
            using (var reader = _connection.QueryReader("SELECT * FROM UserSpecificFunctions"))
            {
                while (reader.Read())
                {
                    var userId   = reader.Get <int>("UserId");
                    var chatData = new ChatInformation(reader.Get <string>("Prefix"), reader.Get <string>("Suffix"),
                                                       reader.Get <string>("Color"));

                    var player = new PlayerMetadata(userId, chatData);
                    using (var reader2 =
                               _connection.QueryReader("SELECT * FROM UserHasPermission WHERE UserId = @0", userId))
                    {
                        while (reader2.Read())
                        {
                            var permissionName = reader.Get <string>("Permission");
                            var isNegated      = reader.Get <int>("IsNegated") == 1;
                            player.Permissions.Add(new Permission(permissionName, isNegated));
                        }
                    }

                    _cache.Add(player);
                }
            }
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="PlayerMetadata" /> class with the specified user ID, chat data and
 ///     permissions.
 /// </summary>
 /// <param name="userId">The user ID.</param>
 /// <param name="chatData">The user's chat information, which may not be null.</param>
 /// <param name="permissions">A collection of the user's permissions, which may not be null.</param>
 public PlayerMetadata(int userId, ChatInformation chatData, PermissionCollection permissions) : this(
         userId, chatData)
 {
     Permissions = permissions ?? throw new ArgumentNullException(nameof(permissions));
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="PlayerMetadata" /> class with the specified user ID and chat data.
 /// </summary>
 /// <param name="userId">The user ID.</param>
 /// <param name="chatData">The user's chat information, which may not be null.</param>
 public PlayerMetadata(int userId, ChatInformation chatData)
 {
     UserId   = userId;
     ChatData = chatData ?? throw new ArgumentNullException(nameof(chatData));
 }