private SecurityConfiguration ToConfiguration(SecuritySnapshot snapshot) { return(SecurityConfiguration.New( accounts: snapshot.Accounts.Select(r => AccountConfiguration.New( name: Name.FromString(r.Name).UnwrapOrThrow(), type: (AccountType)Enum.Parse(typeof(AccountType), r.Type, true), password: r.Password?.Length > 0 ? Option.Some(r.Password) : Option.None(), permissions: r.Permissions.Select(Permission.FromString).SelectSuccess().ToValueObjectSet() )).SelectSuccess().ToArray() ).UnwrapOrThrow()); }