public ActionResult AddDocuments(PatientDocumentViewModel patientDocumentViewModel)
        {
            if (!ModelState.IsValid)
            {
                patientDocumentViewModel.PatientDocumentViewEntity.Patients = GetPatients();
                return View(patientDocumentViewModel);
            }

            if (patientDocumentViewModel.PatientDocumentViewEntity.Patients.SelectedItemId == "-1")
            {
                ModelState.AddModelError("", "Please select patient");
                patientDocumentViewModel.PatientDocumentViewEntity.Patients = GetPatients();
                return View(patientDocumentViewModel);
            }

            System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
            patientDocumentViewModel.PatientDocumentViewEntity.DocumentToUpload.InputStream.CopyTo(memoryStream);
            byte[] documentInByteArray = memoryStream.ToArray();

            Document document = new Document();
            DocumentRepository documentRepository = new DocumentRepository();

            document.ProviderId = int.Parse(Session["ProviderId"].ToString());
            document.PatientId = int.Parse(patientDocumentViewModel.PatientDocumentViewEntity.Patients.SelectedItemId);
            document.DocumentType = patientDocumentViewModel.PatientDocumentViewEntity.DocumentType;
            document.Document1 = documentInByteArray;
            document.CreationTime = DateTime.Now;
            documentRepository.AddDocuments(document);

            return RedirectToAction("AddDocuments", new { patientId = document.PatientId });
        }