Look at the functions in the `ProjectHelpers` class, which will do this for you.