public void SendFileToAnotherUser(FaxFolders sendFileToAnotherUser)
        {
            //1.  Move the file to the new folder
            //2   Insert record giving folder that and name of document

            CurrentDocument currentdocument = new CurrentDocument();
            DocumentRepository documentRepository = new DocumentRepository();
            ArchiveDocument archiveDocument = new ArchiveDocument();

            try {

                using (IDbConnection db = new SqlConnection(ConfigurationValues.PostOfficeDatabaseConnection))
                {

                    string query = "SELECT [ID],[ActiveDirectoryUser],[CurrentDocumentPathXOD],[CurrentDocumentPathPDF]"
                        + " ,[PathToDocument],[CurrentAnnotation],[CurrentListOfDocuments]"
                        + " FROM [CurrentDocument]"
                        + " where [ActiveDirectoryUser] = @ActiveDirectoryUser";

                    currentdocument = db.Query<CurrentDocument>(query, new { @ActiveDirectoryUser = Utility.GetUserName() }).Single();

                    string[] filestoDelete = currentdocument.CurrentListOfDocuments.Split('~');
                    for (int i = 0; i < filestoDelete.Length - 1; i++)
                    {
                        string[] currentDocumentName = filestoDelete[i].Split('\\');
                        Logging.LogErrors(ConfigurationValues.ErrorLogPath, "The document name is: " + currentDocumentName[currentDocumentName.Length - 1]);
                        
                        archiveDocument.ArchiveTheDocument(currentDocumentName[currentDocumentName.Length - 1], filestoDelete[i], Utility.GetUserName());

                        File.Copy(filestoDelete[i], ConfigurationValues.InboundFaxRoot +  sendFileToAnotherUser.NewPath + "\\" + currentDocumentName[currentDocumentName.Length - 1]);

                        try
                        {
                            documentRepository.DeleteDocumentThatIsInAInFolder(filestoDelete[i], Utility.GetUserName());
                            try
                            {
                                File.Delete(filestoDelete[i]);
                            }
                            catch { }
                        }
                        catch (Exception er)
                        {
                            Logging.LogErrors(ConfigurationValues.ErrorLogPath, er.ToString());
                        }
                    }
                }
            }
            catch (Exception er)
            {
                Logging.LogErrors(ConfigurationValues.ErrorLogPath, er.ToString());
            }
        }
        public List<FaxFolders> GetFaxFolders()
        {
            List<FaxFolders> faxFolderList = new List<FaxFolders>();
            List<FaxFolders> faxFolderList2 = new List<FaxFolders>();
            FaxFolders faxFolder = new FaxFolders();
            faxFolder.ID = 0;
            faxFolder.FriendlyName = "Select Folder";
            faxFolder.PhoneNumber = string.Empty;
            faxFolder.NewPath = string.Empty;
            faxFolderList2.Add(faxFolder);

            try
            {
                string query = "SELECT [ID],[FriendlyName],[NewPath]"
                    + " FROM [PostOfficeFolders]"
                    + " order by [FriendlyName]";

                using (SqlConnection db = new SqlConnection(ConfigurationValues.PostOfficeDatabaseConnection))
                {
                    faxFolderList = db.Query<FaxFolders>(query).ToList();

                    for (int i = 0; i < faxFolderList.Count; i++)
                    {
                        faxFolderList2.Add(faxFolderList[i]);

                    }
                    return faxFolderList2;
                }

            }
            catch (Exception er)
            {
                Logging.LogErrors(ConfigurationValues.ErrorLogPath, er.ToString());
                return faxFolderList2;
            }
        }
        private string GetFolderID(string folderName)
        {
            FaxFolders faxFolders = new FaxFolders();
           try
            {
                using (IDbConnection db = new SqlConnection(ConfigurationValues.PostOfficeDatabaseConnection))
                {
                    string query = "SELECT [ID],[FriendlyName],[NewPath]"
                        + " FROM [PostOfficeFolders]"
                        + " where [FriendlyName] = @FriendlyName";

                    faxFolders = db.Query<FaxFolders>(query, new { @FriendlyName = folderName }).Single();

                    return faxFolders.ID.ToString();
                }
            }
            catch (Exception er)
            {
                Logging.LogErrors(ConfigurationValues.ErrorLogPath, er.ToString());
                return string.Empty;
            }
        }
        public OperationResult AddPostOfficeFolders(List<FaxFolders> faxFoldersList)
        {
            FaxFolders faxFoldersFullInformation = new FaxFolders();

            DeleteCurrentList(Utility.GetUserName());

            OperationResult operationResult = new OperationResult();

            for (int i = 0; i < faxFoldersList.Count; i++)
            {
                faxFoldersFullInformation = GetFaxingData(faxFoldersList[i].FriendlyName);

                try
                {
                    string query = "INSERT INTO [PostOfficeFoldersByUser]"
                        + " ("
                        + " [ActiveDirectoryUser]"
                        + " ,[PostOfficeFoldersId]"
                        + ")"
                        + " VALUES"
                        + " ("
                        + "@ActiveDirectoryUser,@PostOfficeFoldersId"
                        + " )";
                    {
                        using (SqlConnection db = new SqlConnection(ConfigurationValues.PostOfficeDatabaseConnection))
                        {

                            db.Execute(query, new
                            {
                                @ActiveDirectoryUser = Utility.GetUserName(),
                                @PostOfficeFoldersId = faxFoldersFullInformation.ID
                            }
                                );
                        }
                    }

                }
                catch (Exception er)
                {
                    operationResult.Success = false;
                    operationResult.AddMessage(er.Message);
                    return operationResult;
                }

            }

            operationResult.Success = true;
            operationResult.ErrorMessage = "None";
            return operationResult;
        }