private void loadDocument()
        {
            string          json         = JsonHelper.loadDocument(Settings.Default.ProjectID, "CommunicationsManagementProcess");
            List <string[]> documentInfo = new List <string[]>();

            newCommunicationsManagementProcessModel     = new CommunicationsManagementProcessModel();
            currentCommunicationsManagementProcessModel = new CommunicationsManagementProcessModel();
            if (json != "")
            {
                versionControl = JsonConvert.DeserializeObject <VersionControl <CommunicationsManagementProcessModel> >(json);
                newCommunicationsManagementProcessModel     = JsonConvert.DeserializeObject <CommunicationsManagementProcessModel>(versionControl.getLatest(versionControl.DocumentModels));
                currentCommunicationsManagementProcessModel = JsonConvert.DeserializeObject <CommunicationsManagementProcessModel>(versionControl.getLatest(versionControl.DocumentModels));

                documentInfo.Add(new string[] { "Document ID", currentCommunicationsManagementProcessModel.DocumentID });
                documentInfo.Add(new string[] { "Document Owner", currentCommunicationsManagementProcessModel.DocumentOwner });
                documentInfo.Add(new string[] { "Issue Date", currentCommunicationsManagementProcessModel.IssueDate });
                documentInfo.Add(new string[] { "Last Save Date", currentCommunicationsManagementProcessModel.LastSavedDate });
                documentInfo.Add(new string[] { "File Name", currentCommunicationsManagementProcessModel.FileName });

                foreach (var row in documentInfo)
                {
                    documentInformation.Rows.Add(row);
                }
                documentInformation.AllowUserToAddRows = false;

                foreach (var row in currentCommunicationsManagementProcessModel.DocumentHistories)
                {
                    documentHistory.Rows.Add(new string[] { row.Version, row.IssueDate, row.Changes });
                }

                foreach (var row in currentCommunicationsManagementProcessModel.DocumentApprovals)
                {
                    documentApprovals.Rows.Add(new string[] { row.Role, row.Name, "", row.DateApproved });
                }

                //txtOverview.Text = currentCommunicationsManagementProcessModel.Overview;
                //txtIntro.Text = currentCommunicationsManagementProcessModel.CommunicationsDocumentsIntro;
                createMessage.Text          = currentCommunicationsManagementProcessModel.CreateMessage;
                communicateMessage.Text     = currentCommunicationsManagementProcessModel.CommunicateMessage;
                communicationsTeam.Text     = currentCommunicationsManagementProcessModel.CommunicationsTeam;
                projectManager.Text         = currentCommunicationsManagementProcessModel.ProjectManagerResponsibilities;
                projectStatusReport.Text    = currentCommunicationsManagementProcessModel.ProjectStatusReport;
                communicationsRegister.Text = currentCommunicationsManagementProcessModel.CommunicationsRegister;
            }
            else
            {
                versionControl = new VersionControl <CommunicationsManagementProcessModel>();
                versionControl.DocumentModels = new List <VersionControl <CommunicationsManagementProcessModel> .DocumentModel>();
                documentInfo.Add(new string[] { "Document ID", "" });
                documentInfo.Add(new string[] { "Document Owner", "" });
                documentInfo.Add(new string[] { "Issue Date", "" });
                documentInfo.Add(new string[] { "Last Save Date", "" });
                documentInfo.Add(new string[] { "File Name", "" });
                foreach (var row in documentInfo)
                {
                    documentInformation.Rows.Add(row);
                }
                documentInformation.AllowUserToAddRows = false;
            }
        }
        public void saveDocument()
        {
            newCommunicationsManagementProcessModel.DocumentID    = documentInformation.Rows[0].Cells[1].Value.ToString();
            newCommunicationsManagementProcessModel.DocumentOwner = documentInformation.Rows[1].Cells[1].Value.ToString();
            newCommunicationsManagementProcessModel.IssueDate     = documentInformation.Rows[2].Cells[1].Value.ToString();
            newCommunicationsManagementProcessModel.LastSavedDate = documentInformation.Rows[3].Cells[1].Value.ToString();
            newCommunicationsManagementProcessModel.FileName      = documentInformation.Rows[4].Cells[1].Value.ToString();

            newCommunicationsManagementProcessModel.DocumentHistories = new List <CommunicationsManagementProcessModel.DocumentHistory>();
            int historyCount = documentHistory.Rows.Count;

            for (int i = 0; i < historyCount - 1; i++)
            {
                var version   = documentHistory.Rows[i].Cells[0].Value?.ToString() ?? "";
                var issueDate = documentHistory.Rows[i].Cells[1].Value?.ToString() ?? "";
                var changes   = documentHistory.Rows[i].Cells[2].Value?.ToString() ?? "";

                newCommunicationsManagementProcessModel.DocumentHistories
                .Add(new CommunicationsManagementProcessModel.DocumentHistory(version, issueDate, changes));
            }

            newCommunicationsManagementProcessModel.DocumentApprovals = new List <CommunicationsManagementProcessModel.DocumentApproval>();
            int approvalRowsCount = documentApprovals.Rows.Count;

            for (int i = 0; i < approvalRowsCount - 1; i++)
            {
                var role      = documentApprovals.Rows[i].Cells[0].Value?.ToString() ?? "";
                var name      = documentApprovals.Rows[i].Cells[1].Value?.ToString() ?? "";
                var signature = documentApprovals.Rows[i].Cells[2].Value?.ToString() ?? "";
                var date      = documentApprovals.Rows[i].Cells[3].Value?.ToString() ?? "";

                newCommunicationsManagementProcessModel.DocumentApprovals
                .Add(new CommunicationsManagementProcessModel.DocumentApproval(role, name, signature, date));
            }

            //newCommunicationsManagementProcessModel.CommunicationsDocumentsIntro = .Text;
            //newCommunicationsManagementProcessModel.Overview = txtOverview.Text;
            newCommunicationsManagementProcessModel.CreateMessage                  = createMessage.Text;
            newCommunicationsManagementProcessModel.CommunicateMessage             = communicateMessage.Text;
            newCommunicationsManagementProcessModel.CommunicationsTeam             = communicationsTeam.Text;
            newCommunicationsManagementProcessModel.ProjectManagerResponsibilities = projectManager.Text;
            newCommunicationsManagementProcessModel.ProjectStatusReport            = projectStatusReport.Text;
            newCommunicationsManagementProcessModel.CommunicationsRegister         = communicationsRegister.Text;

            List <VersionControl <CommunicationsManagementProcessModel> .DocumentModel> documentModels = versionControl.DocumentModels;

            if (!versionControl.isEqual(currentCommunicationsManagementProcessModel, newCommunicationsManagementProcessModel))
            {
                VersionControl <CommunicationsManagementProcessModel> .DocumentModel documentModel = new VersionControl <CommunicationsManagementProcessModel>
                                                                                                     .DocumentModel(newCommunicationsManagementProcessModel, DateTime.Now, VersionControl <CommunicationsManagementProcessModel> .generateID());

                documentModels.Add(documentModel);

                versionControl.DocumentModels = documentModels;
                string json = JsonConvert.SerializeObject(versionControl);
                currentCommunicationsManagementProcessModel = JsonConvert.DeserializeObject <CommunicationsManagementProcessModel>(JsonConvert.SerializeObject(newCommunicationsManagementProcessModel));
                JsonHelper.saveDocument(json, Settings.Default.ProjectID, "CommunicationsManagementProcess");
                MessageBox.Show("Communications Management Process saved successfully", "save", MessageBoxButtons.OK);
            }
            else
            {
                MessageBox.Show("No changes were made!", "save", MessageBoxButtons.OK);
            }
        }