/// <summary>
        /// Inserts a new Substation object to Db or updates any existing Substation objects (based on Substation TLA)
        /// </summary>
        /// <param name="substation">Substation object</param>
        public void SaveSubstation(Substation substation)
        {
            Substation currentSubstation = (from n in this.Context.Names.Where(na => na.Name1.Equals(substation.TLA))
                                            join s in this.Context.Substations on n.SubstationId equals s.Id
                                            select s).FirstOrDefault();

            if (currentSubstation != null)
            {
                currentSubstation.DateUpdated   = DateTime.Now;
                currentSubstation.UserUpdatedId = substation.UserCreatedId;
                currentSubstation.GeoLocationId = substation.GeoLocationId;
                currentSubstation.Description   = substation.Description;
                currentSubstation.IsSynchronousCondenserCapable = substation.IsSynchronousCondenserCapable;
                currentSubstation.Latitude                = substation.Latitude;
                currentSubstation.Longitude               = substation.Longitude;
                currentSubstation.Description             = substation.Description;
                currentSubstation.LocalOperationOrderLink = substation.LocalOperationOrderLink;
                currentSubstation.MeterId               = substation.MeterId;
                currentSubstation.ElectricalGroupId     = substation.ElectricalGroupId;
                currentSubstation.OwnershipTypeId       = substation.OwnershipTypeId;
                currentSubstation.PowerCallId           = substation.PowerCallId;
                currentSubstation.ResourceStatusId      = substation.ResourceStatusId;
                currentSubstation.SingleLineDiagramUri  = substation.SingleLineDiagramUri;
                currentSubstation.SubStationTypeId      = substation.SubStationTypeId;
                currentSubstation.FuelTypeId            = substation.FuelTypeId;
                currentSubstation.CIMLoadTS             = substation.CIMLoadTS;
                currentSubstation.LRBLoadTS             = substation.LRBLoadTS;
                currentSubstation.FacilityLoadTS        = substation.FacilityLoadTS;
                currentSubstation.NITSPlanLoadTS        = substation.NITSPlanLoadTS;
                currentSubstation.LTAPSubRegionId       = substation.LTAPSubRegionId;
                currentSubstation.PrimaryPoi            = substation.PrimaryPoi;
                currentSubstation.SecondaryPoi          = substation.SecondaryPoi;
                currentSubstation.PoiCircuitDesignation = substation.PoiCircuitDesignation;
                currentSubstation.PoiVoltage            = substation.PoiVoltage;
                substation.Id = currentSubstation.Id;
            }
            else
            {
                this.Context.Substations.InsertOnSubmit(substation);
            }
            this.Context.SubmitChanges();
        }
        /// <summary>
        /// Inserts a new Substation object to Db or updates any existing Substation objects (based on Substation ID)
        /// </summary>
        /// <param name="substation">Substation object</param>
        public void SaveSubstationbyID(Substation substation)
        {
            Substation currentSubstation = (from s in this.Context.Substations.Where(sub => sub.Id.Equals(substation.Id))
                                            select s).FirstOrDefault();

            if (currentSubstation != null)
            {
                currentSubstation.DateUpdated   = DateTime.Now;
                currentSubstation.UserUpdatedId = substation.UserCreatedId;
                currentSubstation.GeoLocationId = substation.GeoLocationId;
                //currentSubstation.Description = substation.Description;
                currentSubstation.IsSynchronousCondenserCapable = substation.IsSynchronousCondenserCapable;
                currentSubstation.Latitude                = substation.Latitude;
                currentSubstation.Longitude               = substation.Longitude;
                currentSubstation.Description             = substation.Description;
                currentSubstation.LocalOperationOrderLink = substation.LocalOperationOrderLink;
                currentSubstation.MeterId               = substation.MeterId;
                currentSubstation.ElectricalGroupId     = substation.ElectricalGroupId;
                currentSubstation.OwnershipTypeId       = substation.OwnershipTypeId;
                currentSubstation.PowerCallId           = substation.PowerCallId;
                currentSubstation.ResourceStatusId      = substation.ResourceStatusId;
                currentSubstation.SingleLineDiagramUri  = substation.SingleLineDiagramUri;
                currentSubstation.SubStationTypeId      = substation.SubStationTypeId;
                currentSubstation.FuelTypeId            = substation.FuelTypeId;
                currentSubstation.PrimaryPoi            = substation.PrimaryPoi;
                currentSubstation.SecondaryPoi          = substation.SecondaryPoi;
                currentSubstation.PoiCircuitDesignation = substation.PoiCircuitDesignation;
                currentSubstation.PoiVoltage            = substation.PoiVoltage;
                substation.Id = currentSubstation.Id;
            }
            else
            {
                this.Context.Substations.InsertOnSubmit(substation);
            }
            var cs = this.Context.GetChangeSet();

            this.Context.SubmitChanges();
        }