private void Database_WriteBack(Brother currentParent)
        {
            MySqlCommand sqlCommand = null;
            try
            {
                if( databaseConnection == null ) return;

                if( currentParent.HasChild() )
                {
                    Database_WriteBack( (Brother) currentParent.GetFirstChild() );
                }

                if( currentParent.HasRightSibling() ) 
                {
                    Database_WriteBack( (Brother) currentParent.GetRightSibling() );
                }

                if( currentParent == Root ) return; 
               
                databaseConnection.Open();
                sqlCommand = new MySqlCommand(Util.GetLocalizedString("SQLInsertIntoBrothers"), databaseConnection);

                sqlCommand.Prepare();
                sqlCommand.Parameters.AddWithValue( "@Last", currentParent.LastName );
                sqlCommand.Parameters.AddWithValue( "@First", currentParent.FirstName );
                sqlCommand.Parameters.AddWithValue( "@IniMonth", currentParent.InitiationTerm.ToString() );
                sqlCommand.Parameters.AddWithValue( "@IniYear", currentParent.InitiationYear );

                sqlCommand.Parameters.AddWithValue( "@Big",
                    currentParent.HasParent() 
                        ? ((Brother) currentParent.GetParent()).ToString() 
                        : string.Empty );

                sqlCommand.Parameters.AddWithValue( "@NextSibling",
                    currentParent.HasRightSibling()
                        ? ((Brother) currentParent.GetRightSibling()).ToString()
                        : string.Empty );

                sqlCommand.Parameters.AddWithValue( "@FirstLittle", 
                    currentParent.HasChild() 
                        ? ((Brother) currentParent.GetFirstChild()).ToString() 
                        : string.Empty );

                sqlCommand.ExecuteNonQuery();
                databaseConnection.Close();
            }
            catch ( Exception exception )
            {
                var message = exception.Message;

                if( sqlCommand != null )
                {
                    message += '\n';
                    message += sqlCommand.CommandText;
                }

                MessageBox.Show(message);
            }
        }
        private void EditBrotherPanel_Initalize(Brother brother)
        {
            selectedEdits = FieldEdit.None;
            splitTreeInfo.Panel2Collapsed = false;
            cbSelectedTerm.Enabled = false;
            dtpSelectedYear.Enabled = false;
            tbSelectedFirst.Enabled = false;
            tbSelectedLast.Enabled = false;
            tbSelectedBig.Enabled = false;
            tbSelectedLittles.Enabled = false;
            btnApplySelected.Enabled = false;
            btnCancelSelected.Enabled = false;
            chbActive.Enabled = false;

            if( selected != null && selected != brother )
            {
                var oldWidth = selected.Label.Width;
                selected.Label.Font = new Font( selected.Label.Font, selected.Label.Font.Style & ~FontStyle.Bold );
                selected.Label.Refresh();
                selected.Label.Location = new Point( selected.Label.Location.X + (oldWidth - selected.Label.Width) / 2,
                    selected.Label.Location.Y );
            }

            selected = brother;

            if( selected != null )
            {
                tbSelectedFirst.Text = brother.FirstName;
                tbSelectedLast.Text = brother.LastName;
                tbSelectedBig.Text = brother.HasParent()
                    ? ((Brother)brother.GetParent()).ToString()
                    : string.Empty;
                tbSelectedLittles.Text = string.Empty;

                for (var i = 0; i < brother.ChildCount; i++)
                {
                    var littleBrother = (Brother)brother[i];
                    tbSelectedLittles.Text += (i == 0 ? string.Empty : Environment.NewLine) + littleBrother;
                }

                dtpSelectedYear.Value = new DateTime(brother.InitiationYear, 1, 1);
                if( brother.InitiationTerm.ToString() != string.Empty )
                {
                    cbSelectedTerm.SelectedItem = brother.InitiationTerm.ToString();
                }

                chbActive.Checked = brother.Active;
            }
            
            btnEditSelected.Enabled = true;
        }