///<summary>Allows the user to edit an existing ImageAttachment object.</summary>
        private void CellDoubleClick_EditImage(object sender, ODGridClickEventArgs e)
        {
            GridRow selectedRow = gridAttachedImages.ListGridRows[gridAttachedImages.GetSelectedIndex()];

            ClaimConnect.ImageAttachment selectedAttachment = (ClaimConnect.ImageAttachment)selectedRow.Tag;
            FormClaimAttachmentItemEdit  FormCAIE           = new FormClaimAttachmentItemEdit(selectedAttachment.Image
                                                                                              , selectedAttachment.ImageFileNameDisplay, selectedAttachment.ImageDate, selectedAttachment.ImageType);

            FormCAIE.ShowDialog();
            if (FormCAIE.DialogResult == DialogResult.OK)           //Update row
            {
                _listImageAttachments[gridAttachedImages.GetSelectedIndex()] = FormCAIE.ImageAttachment;
                FillGrid();
            }
        }
        ///<summary>Saves all images in the grid to the patient on the claim's directory in the images module. Also creates
        ///a list of ClaimAttach objects to associate to the given claim.</summary>
        private void buttonOK_Click(object sender, EventArgs e)
        {
            //The user must create an image or narrative attachment before sending.
            if (gridAttachedImages.ListGridRows.Count == 0 && textNarrative.Text.Trim().Length == 0)
            {
                MsgBox.Show(this, "An image or narrative must be specified before continuing.");
                return;
            }
            try {
                CreateAndSendAttachments();
            }
            //Creating and sending Attachments will sometimes time out when an arbirtrarily large group of attachments are being sent,
            //at which point each attachment should be sent individually.
            catch (TimeoutException ex) {
                ex.DoNothing();
                ODProgress.ShowAction(() => { BatchSendAttachments(); }, "Sending attachments timed out. Attempting to send individually. Please wait.");
            }
            catch (ODException ex) {
                //ODExceptions should already be Lans.g when throwing meaningful messages.
                //If they weren't translated, the message was from a third party and shouldn't be translated anyway.
                MessageBox.Show(ex.Message);
                return;
            }
            //Validate the claim, if it isn't valid let the user decide if they want to continue
            if (!ValidateClaimHelper())
            {
                if (!MsgBox.Show(this, MsgBoxButtons.YesNo, "There were errors validating the claim, would you like to continue?"))
                {
                    return;
                }
            }
            //Used for determining which category to save the image attachments to. 0 will save the image to the first category in the Images module.
            long imageTypeDefNum   = 0;
            Def  defClaimAttachCat = CheckImageCatDefs().FirstOrDefault();

            if (defClaimAttachCat != null)
            {
                imageTypeDefNum = defClaimAttachCat.DefNum;
            }
            else              //User does not have a Claim Attachment image category, just use the first image category available.
            {
                imageTypeDefNum = Defs.GetCatList((int)DefCat.ImageCats).FirstOrDefault(x => !x.IsHidden).DefNum;
            }
            List <ClaimAttach> listClaimAttachments = new List <ClaimAttach>();

            for (int i = 0; i < gridAttachedImages.ListGridRows.Count; i++)
            {
                ClaimConnect.ImageAttachment imageRow = ((ClaimConnect.ImageAttachment)gridAttachedImages.ListGridRows[i].Tag);
                if (PrefC.GetBool(PrefName.SaveDXCAttachments))
                {
                    Bitmap   imageBitmap = new Bitmap(imageRow.Image);
                    Document docCur      = ImageStore.Import(imageBitmap, imageTypeDefNum, ImageType.Document, _claimPat);
                    imageRow.ImageFileNameActual = docCur.FileName;
                }
                //Create attachment objects
                listClaimAttachments.Add(CreateClaimAttachment(imageRow.ImageFileNameDisplay, imageRow.ImageFileNameActual));
            }
            //Keep a running list of attachments sent to DXC for the claim. This will show in the attachments listbox.
            _claimCur.Attachments.AddRange(listClaimAttachments);
            Claims.Update(_claimCur);
            MsgBox.Show("Attachments sent successfully!");
            DialogResult = DialogResult.OK;
        }