protected override void btnEdit_Clicked(object o, EventArgs args)
        {
            int selectedRow = grid.FocusedRow;

            if (selectedRow < 0)
            {
                return;
            }

            selectedId = entities [selectedRow].Id;

            // Added transaction to ensure that we are connected to the same server in case of
            // master-slave replication
            using (DbMasterScope scope = new DbMasterScope(BusinessDomain.DataAccessProvider)) {
                using (EditNewPaymentType dialog = new EditNewPaymentType(entities [selectedRow])) {
                    if (dialog.Run() != ResponseType.Ok)
                    {
                        return;
                    }

                    dialog.GetPaymentType().CommitChanges();
                }

                OnEntitiesChanged();
            }
        }
        protected override void btnNew_Clicked(object o, EventArgs args)
        {
            selectedId = null;

            // Added transaction to ensure that we are connected to the same server in case of
            // master-slave replication
            using (new DbMasterScope(BusinessDomain.DataAccessProvider)) {
                using (EditNewPaymentType dialog = new EditNewPaymentType(null)) {
                    if (dialog.Run() != ResponseType.Ok)
                    {
                        return;
                    }

                    selectedId = dialog.GetPaymentType().CommitChanges().Id;
                }

                OnEntitiesChanged();
            }
        }