private void UserInfoContainer_RequestRejected(object sender)
        {
            int requestId = 0;
            UserInfoContainer requestContainer  = sender as UserInfoContainer;
            Point             containerLocation = requestContainer.Location;

            this.pnlAvailableRequests.Controls.Remove(requestContainer);
            this.pnlAvailableRequests.Invalidate();

            foreach (Control control in this.pnlAvailableRequests.Controls)
            {
                if (control is UserInfoContainer)
                {
                    if (control.Location.Y > containerLocation.Y)
                    {
                        control.Location = new Point(control.Location.X, (control.Location.Y - control.Height));
                    }
                }
            }

            // Get the ID of the request itself
            foreach (RequestInformation request in this.requests)
            {
                if (request.Requester.Id == requestContainer.UserId)
                {
                    requestId = request.Id;
                    break;
                }
            }

            // Delete request from the database
            WebConnector.DeleteRequest(requestId);

            // Remove the current request both from the panel and the list containing the requests
            this.requests.RemoveAll(request => request.Requester.Id == requestContainer.UserId);

            // If there's no requests - no need to keep the header up anymore.
            if (requests.Count == 0)
            {
                this.pnlContactsContainer.Controls.Remove(this.pnlAvailableRequests);
            }
        }
        private void AddRequestToContacts(UserInfoContainer container)
        {
            int contactListBottom = GetContactsListLength();
            int requestId         = 0;

            // Get the ID of the request itself
            foreach (RequestInformation request in this.requests)
            {
                if (request.Requester.Id == container.UserId)
                {
                    requestId = request.Id;
                    break;
                }
            }

            RepositionRemainingRequests(container);

            container.Location = new Point(0, contactListBottom);
            contactListBottom += container.Height;

            container.Parent = this.pnlContactsContainer;
            this.pnlContactsContainer.Controls.Add(container);
            this.listContactContainer.Add(container);

            int offset = GetContactsListLength();

            this.pnlAvailableRequests.Location = new Point(this.pnlAvailableRequests.Location.X, offset);

            // Send query to the API so that we actually add the user to the database
            WebConnector.AddContact(this.accountInfo.Id, container.UserId);
            // Remove the request
            WebConnector.DeleteRequest(requestId);

            // Tell server to propagate the request to the accepted client if he's currently available
            string jsonClientInfo = JsonConvert.SerializeObject(this.accountInfo);

            // Send as message
            socketHelper.SendMessage(container.Username, jsonClientInfo, this.accountInfo.Username, @"/accept");
        }