Here's a sample that does that for another project: https://gist.github.com/e0ae48ff451305a00649