/// <summary> /// Generate a <see cref="UserResponse"/> from <see langword="this"/>. /// </summary> /// <param name="recursive">If we should recurse on <see cref="CreatedBy"/>.</param> /// <returns>A new <see cref="UserResponse"/>.</returns> UserResponse CreateUserResponse(bool recursive) { var result = CreateUserName <UserResponse>(); if (recursive) { result.CreatedBy = CreatedBy?.CreateUserName <UserName>(); } result.CreatedAt = CreatedAt; result.Enabled = Enabled; result.SystemIdentifier = SystemIdentifier; result.OAuthConnections = OAuthConnections ?.Select(x => x.ToApi()) .ToList(); result.Group = Group?.ToApi(false); result.PermissionSet = PermissionSet?.ToApi(); return(result); }