private Campaigns.Model.Character CreateCharacter(CreateCharacterViewModel viewModel) { if (null == viewModel) { return(_rules.CreateCharacter("Unnamed", "")); } var standardAllocations = _rules.GetAttributesByCategory("abilities") .Where(a => a.IsStandard) .ToList() .Select(a => new AttributeAllocation { Attribute = a, Value = 8 }); var characterAllocations = new[] { new AttributeAllocation { Attribute = _rules.GetAttributeById(viewModel.RaceId) }, new AttributeAllocation { Attribute = _rules.GetAttributeById(viewModel.InitialClassId), Value = viewModel.Level }, }; var allocations = standardAllocations.Concat(characterAllocations); var newCharacter = _rules.CreateCharacter(viewModel.Name, viewModel.Description, allocations); return(newCharacter); }