             subjectSet = apiClient.createType('subject_sets').createResource subjectSetData
             subjectSet.save()
               .then (subjectSet) ->
+                sharedSubjectLinks =
+                  project: project.id
+                  subject_set: subjectSet.id
+
+                for filename, metadata in wizardData.subjects
+                  subjectData =
+                    locations: [filename]
+                    metadata: metadata
+                    links: Object.create sharedSubjectLinks
+                  subject = apiClient.createType('subject_sets').createResource subjectSetData
+                  # subject.save().then (subject) ->
+                  #   subject.locations
+
                 console.group 'Created!'
                 console.info 'project', project
                 console.info 'workflow', workflow

module.exports = React.createClass
  displayName: 'CreateProjectPage'

  render: ->
    <ChangeListener target={wizardData} handler={@renderWizard} />


        <fieldset>
          <legend>Project name</legend>
          <input type="text" name="name" placeholder="Project name" value={wizardData.name} onChange={@handleInputChange} style={width: '100%'} />
          <br />
          <div className="form-help">This will be used to identify your project across the site.</div>
        </fieldset>
        <fieldset>
          <legend>Introduction</legend>
          <input type="text" name="introduction" placeholder="A catchy slogan for the project" value={wizardData.introduction} onChange={@handleInputChange} style={width: '100%'} />
          <br />
          <div className="form-help">This will often be shown when a link on the site points to your project.</div>
        </fieldset>
        <fieldset>
          <legend>Project description</legend>
          <MarkdownEditor name="description" placeholder="Why is this project interesting?" value={wizardData.description} onChange={@handleInputChange} style={width: '100%'} />
          <br />
          <div className="form-help">Tell people why they should help with your project. What question are you trying to answer, and why is it important?</div>
        </fieldset>
      </div>

