public async void Delete()
        {
            ErrorMessages = null;

            try
            {
                await _materiaEndpoint.Delete(SelectedMateria.Id, _usuarioLogged.Token);
                await LoadMaterias();
            }
            catch (UnauthorizedRequestException)
            {
                ErrorMessages = new BindingList <string> {
                    "No tiene acceso"
                };
            }
            catch (BadRequestException ex)
            {
                ErrorMessages = new BindingList <string>(ex.Errors.Select(kvp => string.Join(". ", kvp.Value)).ToList());
            }
            catch (NotFoundRequestException ex)
            {
                ErrorMessages = new BindingList <string> {
                    $"{ex.NotFoundElement}: Elemento no encontrado"
                };
            }
            catch (Exception ex)
            {
                ErrorMessages = new BindingList <string> {
                    $"{ex.Message} Ha ocurrido un error. Por favor contacte a soporte"
                };
            }
        }
        // Delete - DELETE Materia/ID
        public async Task <ActionResult> Delete(int id)
        {
            try
            {
                await _materiaEndpoint.Delete(id, _userSession.BearerToken);
            }
            catch (UnauthorizedRequestException)
            {
                return(RedirectToAction("AccessDeniedPartial", "Error"));
            }
            catch (NotFoundRequestException ex)
            {
                return(Content($"{ex.StatusCode}: Elemento no encontrado"));
            }
            catch (Exception ex)
            {
                return(RedirectToAction("SpecificErrorPartial", "Error", new { error = ex.Message }));
            }

            // TempData may be used to check in the view whether the deletion was successful or not
            TempData["SuccessMessage"] = "Deleted Sucessfully";

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }