public IActionResult DeletePokemon(int pokemonTeamId, int pokemonTeamDetailId)
        {
            this.UpdatePokemonTeamList();
            if (pokemonTeams.Count < pokemonTeamId)
            {
                return(this.RedirectToAction("PokemonTeams", "User"));
            }
            else
            {
                PokemonTeam                pokemonTeam       = pokemonTeams[pokemonTeamId - 1];
                PokemonTeamDetail          pokemonTeamDetail = this.dataService.GetPokemonTeamDetail(pokemonTeam.GrabPokemonTeamDetailIds()[pokemonTeamDetailId - 1]);
                PokemonTeamDetailViewModel model             = new PokemonTeamDetailViewModel()
                {
                    Id        = pokemonTeamDetail.Id,
                    Pokemon   = pokemonTeamDetail.Pokemon,
                    AppConfig = this.appConfig,
                };

                return(this.View(model));
            }
        }
        /// <summary>
        /// Creates a pokemon for the imported team.
        /// </summary>
        /// <param name="importedPokemon">The pokemon string from the Pokemon Showdown export string.</param>
        /// <returns>The created PokemonTeamDetail object.</returns>
        private PokemonTeamDetailViewModel CreatePokemonDetailFromImport(string importedPokemon)
        {
            PokemonTeamDetailViewModel pokemonTeamDetail = new PokemonTeamDetailViewModel();
            string pokemonName           = importedPokemon.Split("\r\n")[0];
            string remainingImportedText = importedPokemon.Replace(string.Concat(pokemonName, "\r\n"), string.Empty);

            pokemonName = pokemonName.Trim();

            // Held item converter.
            if (pokemonName.IndexOf(" @ ") != -1)
            {
                string     itemName   = pokemonName.Split(" @ ")[1];
                BattleItem battleItem = this.dataService.GetObjectByPropertyValue <BattleItem>("Name", itemName);
                if (battleItem != null)
                {
                    pokemonTeamDetail.BattleItemId = battleItem.Id;
                }

                pokemonName = pokemonName.Split(string.Concat(" @ ", itemName))[0];
            }

            // Gender converter.
            int genderCheckStart = pokemonName.LastIndexOf('(');

            if (genderCheckStart != -1 && pokemonName.Substring(genderCheckStart + 2, 1) == ")")
            {
                string genderInitial = pokemonName.Substring(genderCheckStart + 1, 1);
                if (genderInitial == "M")
                {
                    pokemonTeamDetail.Gender = "Male";
                }
                else if (genderInitial == "F")
                {
                    pokemonTeamDetail.Gender = "Female";
                }

                pokemonName = pokemonName.Split(string.Concat(" (", genderInitial, ")"))[0];
            }

            // Nickname converter.
            if (pokemonName.IndexOf("(") != -1)
            {
                pokemonTeamDetail.Nickname = pokemonName.Substring(0, pokemonName.IndexOf("(") - 1);
                pokemonName = pokemonName.Replace(string.Concat(pokemonTeamDetail.Nickname, " ("), string.Empty);
                pokemonName = pokemonName.Replace(")", string.Empty);
            }

            // Pokemon converter.
            Pokemon pokemon;

            // Converts Pokemon Showdown's apostrophe to the database's apostrophe.
            pokemonName = pokemonName.Replace('’', '\'');

            // Used to check for alternate form
            if (pokemonName.LastIndexOf('-') != -1)
            {
                if (pokemonName.Contains("Gmax"))
                {
                    pokemonName = pokemonName.Replace("-Gmax", "-Gigantamax");
                }

                if (pokemonName == "Meowstic-F" || pokemonName == "Indeedee-F")
                {
                    pokemonName = pokemonName.Replace("-F", "-Female");
                }

                List <Form> forms = this.dataService.GetObjects <Form>("Name");
                foreach (var f in forms)
                {
                    f.Name = f.Name.Replace(' ', '-');
                }

                string formName = pokemonName.Remove(0, pokemonName.IndexOf('-') + 1);

                Form form = forms.Find(x => x.Name == formName);

                if (form != null)
                {
                    pokemon = this.dataService.GetPokemonFromNameAndFormName(pokemonName.Replace(string.Concat("-", form.Name), string.Empty), form.Name.Replace('-', ' '));
                }
                else
                {
                    pokemon = this.dataService.GetPokemon(pokemonName);
                }
            }
            else
            {
                pokemon = this.dataService.GetPokemon(pokemonName);
            }

            pokemonTeamDetail.PokemonId = pokemon.Id;

            // Ability converter.
            Ability ability;
            string  abilityName = remainingImportedText.Split("\r\n")[0];

            if (abilityName.Contains("Ability: "))
            {
                remainingImportedText = remainingImportedText.Replace(string.Concat(abilityName, "\r\n"), string.Empty);
                abilityName           = abilityName.Split("Ability: ")[1].Trim();
                ability = this.dataService.GetObjectByPropertyValue <Ability>("Name", abilityName);
            }
            else
            {
                ability = this.dataService.GetAbilitiesForPokemon(pokemon.Id)[0];
            }

            pokemonTeamDetail.AbilityId = ability.Id;

            // Level converter.
            if (remainingImportedText.Contains("Level:"))
            {
                string pokemonLevel = remainingImportedText.Split("\r\n")[0];
                remainingImportedText   = remainingImportedText.Replace(string.Concat(pokemonLevel, "\r\n"), string.Empty);
                pokemonLevel            = pokemonLevel.Trim();
                pokemonTeamDetail.Level = Convert.ToByte(pokemonLevel.Substring(pokemonLevel.IndexOf(':') + 2, pokemonLevel.Length - (pokemonLevel.IndexOf(':') + 2)));
                if (pokemonTeamDetail.Level == 0)
                {
                    pokemonTeamDetail.Level = 1;
                }
                else if (pokemonTeamDetail.Level > 100 || string.Compare(pokemonTeamDetail.Level.ToString(), pokemonLevel.Substring(pokemonLevel.IndexOf(':') + 2)) != 0)
                {
                    pokemonTeamDetail.Level = 100;
                }
            }
            else
            {
                pokemonTeamDetail.Level = 100;
            }

            // Shiny converter.
            if (remainingImportedText.Contains("Shiny: Yes"))
            {
                remainingImportedText     = remainingImportedText.Replace(string.Concat(remainingImportedText.Split("\r\n")[0], "\r\n"), string.Empty);
                pokemonTeamDetail.IsShiny = true;
            }

            // Happiness converter.
            if (remainingImportedText.Contains("Happiness:"))
            {
                string happiness = remainingImportedText.Split("\r\n")[0];
                remainingImportedText       = remainingImportedText.Replace(string.Concat(happiness, "\r\n"), string.Empty);
                happiness                   = happiness.Trim();
                pokemonTeamDetail.Happiness = Convert.ToByte(happiness.Substring(happiness.IndexOf(':') + 2, happiness.Length - (happiness.IndexOf(':') + 2)));
                if (string.Compare(pokemonTeamDetail.Happiness.ToString(), happiness.Substring(happiness.IndexOf(':') + 2)) != 0)
                {
                    pokemonTeamDetail.Happiness = 255;
                }
            }
            else
            {
                pokemonTeamDetail.Happiness = 255;
            }

            // EV converter.
            if (remainingImportedText.Contains("EVs:"))
            {
                string evs = remainingImportedText.Split("\r\n")[0];
                remainingImportedText = remainingImportedText.Replace(string.Concat(evs, "\r\n"), string.Empty);
                PokemonTeamEV pokemonEVs = new PokemonTeamEV();
                if (evs.Contains("HP"))
                {
                    string health = evs.Substring(evs.IndexOf("HP") - 4, 3);
                    health            = health.Replace(":", string.Empty).Replace("/", string.Empty).Trim();
                    pokemonEVs.Health = Convert.ToByte(health);
                }

                if (evs.Contains("Atk"))
                {
                    string attack = evs.Substring(evs.IndexOf("Atk") - 4, 3);
                    attack            = attack.Replace(":", string.Empty).Replace("/", string.Empty).Trim();
                    pokemonEVs.Attack = Convert.ToByte(attack);
                }

                if (evs.Contains("Def"))
                {
                    string defense = evs.Substring(evs.IndexOf("Def") - 4, 3);
                    defense            = defense.Replace(":", string.Empty).Replace("/", string.Empty).Trim();
                    pokemonEVs.Defense = Convert.ToByte(defense);
                }

                if (evs.Contains("SpA"))
                {
                    string specialAttack = evs.Substring(evs.IndexOf("SpA") - 4, 3);
                    specialAttack            = specialAttack.Replace(":", string.Empty).Replace("/", string.Empty).Trim();
                    pokemonEVs.SpecialAttack = Convert.ToByte(specialAttack);
                }

                if (evs.Contains("SpD"))
                {
                    string specialDefense = evs.Substring(evs.IndexOf("SpD") - 4, 3);
                    specialDefense            = specialDefense.Replace(":", string.Empty).Replace("/", string.Empty).Trim();
                    pokemonEVs.SpecialDefense = Convert.ToByte(specialDefense);
                }

                if (evs.Contains("Spe"))
                {
                    string speed = evs.Substring(evs.IndexOf("Spe") - 4, 3);
                    speed            = speed.Replace(":", string.Empty).Replace("/", string.Empty).Trim();
                    pokemonEVs.Speed = Convert.ToByte(speed);
                }

                pokemonTeamDetail.EVs = pokemonEVs;
            }

            // Nature converter.
            if (remainingImportedText.Contains("Nature"))
            {
                string natureName = remainingImportedText.Split("\r\n")[0];
                remainingImportedText = remainingImportedText.Replace(string.Concat(natureName, "\r\n"), string.Empty);
                natureName            = natureName.Replace("Nature", string.Empty).Trim();
                Nature nature = this.dataService.GetObjectByPropertyValue <Nature>("Name", natureName);
                pokemonTeamDetail.NatureId = nature.Id;
            }
            else
            {
                pokemonTeamDetail.NatureId = this.dataService.GetObjectByPropertyValue <Nature>("Name", "Serious").Id;
            }

            // IV converter.
            if (remainingImportedText.Contains("IVs:"))
            {
                string ivs = remainingImportedText.Split("\r\n")[0];
                remainingImportedText = remainingImportedText.Replace(string.Concat(ivs, "\r\n"), string.Empty);
                PokemonTeamIV pokemonIVs = new PokemonTeamIV();
                if (ivs.Contains("HP"))
                {
                    string health = ivs.Substring(ivs.IndexOf("HP") - 3, 2).Trim();
                    pokemonIVs.Health = Convert.ToByte(health);
                }

                if (ivs.Contains("Atk"))
                {
                    string health = ivs.Substring(ivs.IndexOf("Atk") - 3, 2).Trim();
                    pokemonIVs.Attack = Convert.ToByte(health);
                }

                if (ivs.Contains("Def"))
                {
                    string health = ivs.Substring(ivs.IndexOf("Def") - 3, 2).Trim();
                    pokemonIVs.Defense = Convert.ToByte(health);
                }

                if (ivs.Contains("SpA"))
                {
                    string health = ivs.Substring(ivs.IndexOf("SpA") - 3, 2).Trim();
                    pokemonIVs.SpecialAttack = Convert.ToByte(health);
                }

                if (ivs.Contains("SpD"))
                {
                    string health = ivs.Substring(ivs.IndexOf("SpD") - 3, 2).Trim();
                    pokemonIVs.SpecialDefense = Convert.ToByte(health);
                }

                if (ivs.Contains("Spe"))
                {
                    string health = ivs.Substring(ivs.IndexOf("Spe") - 3, 2).Trim();
                    pokemonIVs.Speed = Convert.ToByte(health);
                }

                pokemonTeamDetail.IVs = pokemonIVs;
            }

            // Moveset converter.
            if (remainingImportedText.Contains("- "))
            {
                List <string>      moves      = remainingImportedText.Split("\r\n").ToList();
                List <string>      validMoves = new List <string>();
                string             move;
                PokemonTeamMoveset moveset = new PokemonTeamMoveset();

                foreach (var m in moves)
                {
                    if (!string.IsNullOrEmpty(m) && validMoves.Count < 4)
                    {
                        validMoves.Add(m);
                    }
                }

                foreach (var m in validMoves)
                {
                    move = m.Substring(2, m.Length - 2).Trim();
                    moveset.FourthMove = move;
                    moveset            = this.dataService.SortMoveset(moveset);
                }

                pokemonTeamDetail.Moveset = moveset;
            }

            return(pokemonTeamDetail);
        }