private void LoadButton_Click(object sender, EventArgs e) { OpenFileDialog.Filter = "Microsoft Word 2007|*.docx|All files (*.*)|*.*"; OpenFileDialog.FilterIndex = 1; OpenFileDialog.RestoreDirectory = true; if (OpenFileDialog.ShowDialog() == DialogResult.OK) { byte[] fileHash = FileHasher.HashMD5(OpenFileDialog.FileName); if (!fileRepository.CheckFileHash(fileHash) && fileRepository.InsertFileHashInDB(OpenFileDialog.FileName, fileHash)) { Cursor.Current = Cursors.WaitCursor; parser = new DocumentParser(OpenFileDialog.FileName); parser.ParseDocument(); pairRepository.InsertPairs(parser.ParseDocument()); Cursor.Current = Cursors.Arrow; } else { MessageBox.Show("File already exist in DB", "ScheduleApp"); } } }