Why not just use `elgg_format_attributes` with some additional params filtering?