/// <summary>
        /// Add allergy to the current patient
        /// </summary>
        /// <returns></returns>
        public JsonResult AddAllergyToPatient()
        {
            try
            {
                int patientId = int.Parse(Request.Form["PatientId"]);
                int allergyId = int.Parse(Request.Form["AllergyId"]);

                PatientRepository patientRepo = new PatientRepository();
                var patient = patientRepo.Get(patientId);

                PatientAllergyRepository patientAllergyRepo = new PatientAllergyRepository();
                AllergyRepository allergyRepo = new AllergyRepository();

                PatientAllergy pallergy = new PatientAllergy();
                pallergy.Allergy = allergyRepo.Get(allergyId);
                pallergy.Patient = patient;
                patientAllergyRepo.Add(pallergy);

                return Json(new
                {
                    error = "false",
                    status = "Added patient allergy successfully",
                    ID = pallergy.Id,
                    Name = pallergy.Allergy.Name
                });

            }
            catch (Exception e)
            {

                return Json(new
                {
                    error = "true",
                    status = "Unable to add patient allergy!",
                    errorMessage = e.Message
                });
            }
        }
        /// <summary>
        /// Remove allergy from patient
        /// </summary>
        /// <returns></returns>
        public JsonResult RemoveAllergy()
        {
            try
            {
                PatientAllergyRepository patientAllergyRepo = new PatientAllergyRepository();
                PatientRepository patientRepo = new PatientRepository();
                AllergyRepository allergyRepo = new AllergyRepository();

                var patientId = patientRepo.Get(int.Parse(Request.Form["patientID"]));
                var allergyId = allergyRepo.Get(int.Parse(Request.Form["allergyID"]));

                PatientAllergy pa = new PatientAllergy();

                pa.Allergy = allergyId;
                pa.Patient = patientId;

                patientAllergyRepo.Remove(pa);

                //UnitOfWork.CurrentSession.Flush();

                return Json(new
                {
                    error = "false",
                    status = "Allergy Deleted"
                });
            }
            catch (Exception e)
            {

                return Json(new
                {
                    error = "true",
                    status = "Unable to remove patient allergy!",
                    errorMessage = e.Message
                });
            }
        }