Consolidate project query logic