/// <summary>
        /// Inserts a new record into the database
        /// </summary>
        /// <param name="customerNumber">customer number for this entry</param>
        /// <param name="fileName">name of the file</param>
        /// <param name="endLocation">Where we moved the file to</param>
        /// <param name="isProblem"> 0 if there was no problem, 1 if there was a problem</param>
        /// <param name="contractType">What type of contract we are adding</param>
        private static void insertToDatabase(DownloadedFile file)
        {
            SqlConnection conn = new SqlConnection(connString);
            SqlCommand command;
            try
            {
                command = new SqlCommand("dbo.SP_FileAudit_INSERTRECORD", conn);
                command.CommandType = CommandType.StoredProcedure;

                command.Parameters.Add("@FILE_NAME", SqlDbType.NVarChar);
                command.Parameters["@FILE_NAME"].Direction = ParameterDirection.Input;
                command.Parameters["@FILE_NAME"].Value = correctFormatColumn(file.name, SqlDbType.NVarChar);

                command.Parameters.Add("@FILE_DISH_LOCATION", SqlDbType.NVarChar);
                command.Parameters["@FILE_DISH_LOCATION"].Direction = ParameterDirection.Input;
                command.Parameters["@FILE_DISH_LOCATION"].Value = correctFormatColumn(file.fullOriginalPath, SqlDbType.NVarChar);

                command.Parameters.Add("@FILE_LOCAL_LOCATION", SqlDbType.NVarChar);
                command.Parameters["@FILE_LOCAL_LOCATION"].Direction = ParameterDirection.Input;
                command.Parameters["@FILE_LOCAL_LOCATION"].Value = correctFormatColumn(file.fullFinalPath, SqlDbType.NVarChar);

                conn.Open();
                command.ExecuteReader();
                conn.Close();
            }
            catch (Exception e)
            {
                appendToBody(String.Format("Exception dbo.SP_FileAudit_INSERTRECORD...{0}", e));
                conn.Close();

            }
            finally
            {
                conn.Close();
            }
        }
        private static void downloadFile(FtpClient client, FtpListItem file, bool deleteFtpFile)
        {
            string destinationPath = String.Format(@"{0}\{1}", Directory.GetCurrentDirectory(), file.Name);

            using (var ftpStream = client.OpenRead(file.FullName)) {
                using (var fileStream = File.Create(destinationPath, (int)ftpStream.Length)) {
                    var buffer = new byte[8 * 1024];
                    int count;
                    while ((count = ftpStream.Read(buffer, 0, buffer.Length)) > 0) {
                        fileStream.Write(buffer, 0, count);
                    }
                }
            }
            DownloadedFile temp = new DownloadedFile();
            temp.originalPath = file.FullName;
            temp.fullOriginalPath = client.Host + file.FullName;
            temp.finalPath = destinationPath;
            temp.name = file.Name;
            temp.extension = ".txt";
            minervaFiles.Add(temp);
            if (deleteFtpFile) {
                client.DeleteFile(file.FullName);
            }
        }
 private static void ftpUploadFile(FtpClient client, string ftpDirectory, DownloadedFile file, bool deleteOriginalFile, bool insertAuditRecord)
 {
     if (client.IsConnected)
     {
         using (var fileStream = File.OpenRead(file.finalPath))
         {
             using (var ftpStream = client.OpenWrite(string.Format("{0}/{1}", ftpDirectory, file.name)))
             {
                 try
                 {
                     //Copyies the file to the ftp.
                     fileStream.CopyTo(ftpStream);
                 }
                 catch (Exception e)
                 {
                     appendToBody(String.Format("Exception CopyTo ftp...{0}", e));
                 }
             }
         }
         if (insertAuditRecord) {
             insertToDatabase(file);
         }
         if (deleteOriginalFile)
         {
             File.Delete(file.finalPath);
         }
     }
     else
     {
         Console.WriteLine("FTP doesn't have a connection, file upload failed");
     }
 }