public static DataClasses.CustomProgram GetCustomProgramRemotePB(int UserID)
        {
            DataClasses.GrucoxDataClassesRemoteDBDataContext dc = new DataClasses.GrucoxDataClassesRemoteDBDataContext();
            DataClasses.CustomProgram customProgramPB = new DataClasses.CustomProgram();
            List<DataClasses.GrucoxCustomProgramSession> ListcustomProgramPB = new List<DataClasses.GrucoxCustomProgramSession>();

            try
            {
                ListcustomProgramPB = (from sessions in dc.GetTable<DataClasses.GrucoxCustomProgramSession>()
                                       where sessions.LiveUserID == UserID
                                       select sessions).ToList<DataClasses.GrucoxCustomProgramSession>();
            }
            catch (Exception)
            {
                //For Diagnostics - Should be removed
                DataComms.CreateThreadInstance("DB Access during GetCustomProgramRemotePB");
            }
            finally
            {
                customProgramPB.LeftAvgConcP = ListcustomProgramPB.Max(z => z.LeftAvgConcP).HasValue ? (double)ListcustomProgramPB.Max(z => z.LeftAvgConcP) : 0.0;
                customProgramPB.LeftAvgEcceP = ListcustomProgramPB.Max(z => z.LeftAvgEcceP).HasValue ? (double)ListcustomProgramPB.Max(z => z.LeftAvgEcceP) : 0.0;
                customProgramPB.RightAvgConcP = ListcustomProgramPB.Max(z => z.RightAvgConcP).HasValue ? (double)ListcustomProgramPB.Max(z => z.RightAvgConcP) : 0.0;
                customProgramPB.RightAvgEcceP = ListcustomProgramPB.Max(z => z.RightAvgEcceP).HasValue ? (double)ListcustomProgramPB.Max(z => z.RightAvgEcceP) : 0.0;
            }
            return customProgramPB;
        }
        public static DataClasses.CustomProgram GetCustomProgramLocalPB(int UserID)
        {
            DataClasses.GrucoxDataClassDataContext dc = new DataClasses.GrucoxDataClassDataContext();
            DataClasses.CustomProgram customProgramPB = new DataClasses.CustomProgram();

            try
            {
                var ListcustomProgramPB = (from sessions in dc.GetTable<DataClasses.CustomProgram>()
                                           where sessions.UserID == UserID
                                           select sessions).ToList<DataClasses.CustomProgram>();

                customProgramPB.LeftAvgConcP = ListcustomProgramPB.Max(z => z.LeftAvgConcP);
                customProgramPB.LeftAvgEcceP = ListcustomProgramPB.Max(z => z.LeftAvgEcceP);
                customProgramPB.RightAvgConcP = ListcustomProgramPB.Max(z => z.RightAvgConcP);
                customProgramPB.RightAvgEcceP = ListcustomProgramPB.Max(z => z.RightAvgEcceP);


                if (customProgramPB.LeftAvgConcP == null) customProgramPB.LeftAvgConcP = 0;
                if (customProgramPB.LeftAvgEcceP == null) customProgramPB.LeftAvgEcceP = 0;
                if (customProgramPB.RightAvgConcP == null) customProgramPB.RightAvgConcP = 0;
                if (customProgramPB.RightAvgEcceP == null) customProgramPB.RightAvgEcceP = 0;
            }
            catch (Exception)
            { 
                customProgramPB.LeftAvgConcP = 0;
                customProgramPB.LeftAvgEcceP = 0;
                customProgramPB.RightAvgConcP = 0;
                customProgramPB.RightAvgEcceP = 0;
            }

            return customProgramPB;
        }