public ActionResult DeactivateMeasurement()
        {
            //gethering strings from request object
            string measureIdString = Request["measureId"];
            string reason = Request["deactivateReason"];

            //validation section
            if (!ValidateMeasureId(measureIdString))
                return RedirectToAction("Index");
            int measureId = int.Parse(measureIdString);
            TempData["OldMeasureId"] = measureId;

            if (!ValidateReason(reason))
                return RedirectToAction("Index");

            //get old measurement, toggle the activated indicator
            var measure = _repository.GetMeasurementFromId(measureId);

            short indicator = measure.Activated_IN;
            indicator = (short)((indicator == 0)
                ? 1
                : 0);

            measure.Activated_IN = indicator;

            MeasurementAudit measureAuditEnty = new MeasurementAudit
            {
                ChangedBy_NM = ActiveDirectoryResource.GetUsername(),
                Changed_DT = DateTime.Now,
                Measurement_ID = measureId,
                Reason_TXT = reason,
                Description_TXT = (indicator == 1)
                    ? measure.NM + " was activated"
                    : measure.NM + " was deactivated"
            };

            try
            {
                //save to db
                _db.Measurements.AddOrUpdate(measure);
                _db.MeasurementAudits.Add(measureAuditEnty);
                _db.SaveChanges();
            }
            catch (DbException)
            {
                TempData["Error"] = "Something went wrong with the database, please try again later!";
            }
            catch (DbUpdateException)
            {
                TempData["Error"] = "Something went wrong with the database, please try again later!";
            }

            return RedirectToAction("Index");
        }
 //Method that saves Measurement Audit information into the audit table
 private void InsertIntoMeasurementAuditTable(int measureId, string description, string reason)
 {
     MeasurementAudit measureAuditEntry = new MeasurementAudit()
     {
         Changed_DT = DateTime.Now,
         ChangedBy_NM = ActiveDirectoryResource.GetUsername(),
         Description_TXT = description,
         Measurement_ID = measureId,
         Reason_TXT = reason
     };
     try
     {
         _db.MeasurementAudits.Add(measureAuditEntry);
     }
     catch (DbException)
     {
     }
     catch (DbUpdateException)
     {
     }
 }