public static function maybe_create_time_activity()
 {
     if (!current_user_can('edit_sprout_invoices')) {
         self::ajax_fail('User cannot create SI time!');
     }
     $nonce = $_REQUEST['nonce'];
     if (!wp_verify_nonce($nonce, self::SUBMISSION_NONCE)) {
         self::ajax_fail('Not going to fall for it!');
     }
     if (!isset($_REQUEST['name']) || $_REQUEST['name'] == '') {
         self::ajax_fail('No name given.');
     }
     $args = array();
     $args['name'] = $_REQUEST['name'];
     $args['billable'] = isset($_REQUEST['billable']) ? true : false;
     if (isset($_REQUEST['rate'])) {
         $args['rate'] = (double) $_REQUEST['rate'];
     }
     if (isset($_REQUEST['percentage'])) {
         $args['percentage'] = (double) $_REQUEST['percentage'];
     }
     $id = SI_Time::new_activity($args);
     $time = SI_Time::get_instance($id);
     $response = array('id' => $id, 'title' => get_the_title($id), 'option_name' => $time->get_title());
     header('Content-type: application/json');
     if (self::DEBUG) {
         header('Access-Control-Allow-Origin: *');
     }
     echo wp_json_encode($response);
     exit;
 }