private void DeleteCurrentTeamRecord(string dreamTeamId)
 {
     try
     {
         using (TBCL3FantasyLeagueEntities context = new TBCL3FantasyLeagueEntities())
         {
             try
             {
                 if (context.Database.Exists())
                 {
                     DreamTeam dreamTeam = new DreamTeam()
                     {
                         DreamTeamId = dreamTeamId
                     };
                     context.DreamTeams.Attach(dreamTeam);
                     context.DreamTeams.Remove(dreamTeam);
                     context.SaveChanges();
                 }
                 else
                 {
                     throw new ApplicationException("Connectivity issues with database.Contact Admin");
                 }
             }
             catch (Exception ex)
             {
                 throw ex;
             }
         }
     }
     catch (Exception ex)
     {
         throw new ApplicationException("Connectivity issues with database.Contact Admin. \n Details: " + ex.Message);
     }
 }
        private void UpdateDreamTeam(string dreamTeamName, string captainName, string viceCaptainName, string dreamTeamId)
        {
            DreamTeam dreamTeamObj = new DreamTeam()
            {
                TeamName      = dreamTeamName,
                Captain       = captainName,
                ViceCaptain   = viceCaptainName,
                DateSubmitted = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")),
                DreamTeamId   = dreamTeamId,
                MoneyPaid     = false
            };

            try
            {
                using (TBCL3FantasyLeagueEntities context = new TBCL3FantasyLeagueEntities())
                {
                    try
                    {
                        if (context.Database.Exists())
                        {
                            context.DreamTeams.Add(dreamTeamObj);
                            context.SaveChanges();
                        }
                        else
                        {
                            new ApplicationException("Connectivity issues with database.Contact Admin");
                        }
                    }
                    catch (SqlException ex)
                    {
                        if (ex.Number == 2627)
                        {
                            new ApplicationException("Someone already reserved the team name today.Choose different team name");
                        }
                        else
                        {
                            throw ex;
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException("Connectivity issues with database.Contact Admin. \n Details: " + ex.Message);
            }
        }