move tagging functionality to api so it can be more globally used