public IActionResult Save(CharacterViewModel characterViewModel) { var mapper = new MappingProfile(); characterViewModel.Relationships.AddRange(HttpContext.Session.GetComplexData <List <RelationshipViewModel> >("NewRelationships")); var character = Mapper.Map <Character>(characterViewModel); if (characterViewModel.Id == 0) { charactersRepository.AddCharacter(character); } else { charactersRepository.UpdateCharacter(character); } return(Redirect($"/Home/CharacterView?characterId={character.Id}")); }