this seems like a separate component, can we abstract line 64 to 77 into a `create_media(media)` or similar function