Display the next and previous category
Based on your example and description, it's a bit hard to tell whether you are dealing with a category template or an entry template, because in your description you say that the category handle is called 'media', but in the example you are grabbing entries in the section called 'media'.

Assuming you are on a category template (i.e. trying to create a category index page for example), then you should be able to just grab the current category from the 'category' variable (provided by craft), entries related to that category using relatedTo(category), and the next and previous categories from category.nextSibling and category.previousSibling (or category.next and category.previous depending on whether your categories are hierarchical). If so, then the following should work (not tested):

{# category template #}

{% set prevCategory = category.prevSibling %}
{% set nextCategory = category.nextSibling %}
{% set entries = craft.entries('mySection').relatedTo(category) %}

&lt;h1&gt;{{ category.title }}&lt;/h1&gt;
&lt;section class="category-index"&gt;
    {% for entry in entries %}
        &lt;article&gt;
            &lt;h2&gt;{{ entry.title }}&lt;/h2&gt;
            &lt;p&gt;...&lt;/p&gt;
        &lt;/article&gt;
    {% endfor %}
&lt;/section&gt;

{% if prevCategory %}&lt;a href="{{ prevCategory.url }}"&gt;Previous&lt;/a&gt; {% endif %}{% if nextCategory %}&lt;a href="{{ nextCategory.url }}"&gt;Next&lt;/a&gt;{% endif %}


If you are dealing with an entry template (i.e. an entry detail page), then you may need to clarify the question a bit.