 						source_project_display_name: projectDisplayName
 					})
 					.then () ->
-						$scope._reset(err: false)
+						_reset(err: false)
 						$modalInstance.close()
 					.catch (response)->
 						{ data } = response
-						$scope._reset(err: true)
+						_reset(err: true)
 
 			$scope.cancel = () ->
 				$modalInstance.dismiss('cancel')

				if fileName
					$scope.data.name = fileName

			$scope._setInFlight = (type) ->
				$scope.state.inFlight[type] = true

			$scope._reset = (opts) ->
				isError = opts.err == true
				inFlight = $scope.state.inFlight
				inFlight.projects = inFlight.entities = inFlight.create = false

					$scope.data.projectEntities = null
					$scope.data.projects = resp.data.projects.filter (p) ->
						p._id != ide.project_id
					_reset(err: false)
				.catch (err) ->
					_reset(err: true)

			$scope.getProjectEntities = (project_id) =>
				_setInFlight('entities')
				ide.$http.get("/project/#{project_id}/entities", {
					_csrf: window.csrfToken
				})
				.then (resp) ->
					if $scope.data.selectedProjectId == resp.data.project_id
						$scope.data.projectEntities = resp.data.entities
						_reset(err: false)
				.catch (err) ->
					_reset(err: true)

			$scope.init = () ->
				$scope.getUserProjects()
			$timeout($scope.init, 0)

			$scope.create = () ->
				projectId = $scope.data.selectedProjectId
