/**
  * create a Volunteer Need
  * takes an associative array and creates a Need object
  *
  * This function is invoked from within the web form layer and also from the api layer
  *
  * @param array   $params      (reference ) an assoc array of name/value pairs
  *
  * @return CRM_Volunteer_BAO_Need object
  * @access public
  * @static
  */
 static function &create($params)
 {
     $need = new CRM_Volunteer_BAO_Need();
     $need->copyValues($params);
     $projectId = $need->getProjectId();
     if ($projectId === FALSE) {
         CRM_Core_Error::fatal('Missing required Need ID or Project ID');
     }
     // creating a Need constitutes updating a Project
     $op = CRM_Core_Action::UPDATE;
     if (!empty($params['check_permissions']) && !CRM_Volunteer_Permission::checkProjectPerms($op, $projectId)) {
         CRM_Utils_System::permissionDenied();
         // FIXME: If we don't return here, the script keeps executing. This is not
         // what I expect from CRM_Utils_System::permissionDenied().
         return FALSE;
     }
     if (empty($params)) {
         return;
     }
     $need->save();
     return $need;
 }