public void Add() { if (!IsEdit) { string x = PermissionService.Add(Name, Description, SelectedRank?.Id); if (x == null) { TryClose(); } else { Error = x; } } else { toEdit.Name = Name; toEdit.Description = Description; toEdit.MinRankId = SelectedRank.Id; string x = PermissionService.Edit(toEdit); if (x == null) { TryClose(); } else { Error = x; } } }