private function _buildRecordObjects($result, $adjustTime = true)
 {
     while ($row = mysql_fetch_array($result)) {
         $attendanceObj = new AttendanceRecord();
         $attendanceObj->setAttendanceId($row['attendance_id']);
         $attendanceObj->setEmployeeId($row['employee_id']);
         /* $row['punchin_time'] comes in '0000-00-00 00:00:00' format.
          * We want date in '0000-00-00' format and time in '00:00' format.
          */
         $tmpArr = explode(' ', $row['punchin_time']);
         $attendanceObj->setInDate($tmpArr[0]);
         $attendanceObj->setInTime(substr($tmpArr[1], 0, 5));
         if ($row['punchout_time'] != null) {
             $tmpArr = explode(' ', $row['punchout_time']);
             $attendanceObj->setOutDate($tmpArr[0]);
             $attendanceObj->setOutTime(substr($tmpArr[1], 0, 5));
             // Omiting 'seconds' part is ok since it is always zero
         }
         if ($row['in_note'] != null) {
             $attendanceObj->setInNote($row['in_note']);
         }
         if ($row['out_note'] != null) {
             $attendanceObj->setOutNote($row['out_note']);
         }
         $attendanceObj->setTimestampDiff($row['timestamp_diff']);
         $attendanceObj->setStatus($row['status']);
         /* Adjusting time according to the timezone of the place 
          * where the record was first entered.
          */
         if ($adjustTime) {
             /* When saving in the database, timestampDiff is calculated by substracting
              * server timezone offset from client timezone offset. When showing records
              * to user this timestampDiff should be added to each date and time shown.
              */
             $value = $attendanceObj->getInDate() . ' ' . $attendanceObj->getInTime();
             $date = date('Y-m-d', strtotime($value) + $row['timestamp_diff']);
             $time = date('H:i', strtotime($value) + $row['timestamp_diff']);
             $attendanceObj->setInDate($date);
             $attendanceObj->setInTime($time);
             if ($row['punchout_time'] != null) {
                 $value = $attendanceObj->getOutDate() . ' ' . $attendanceObj->getOutTime();
                 $date = date('Y-m-d', strtotime($value) + $row['timestamp_diff']);
                 $time = date('H:i', strtotime($value) + $row['timestamp_diff']);
                 $attendanceObj->setOutDate($date);
                 $attendanceObj->setOutTime($time);
             }
         }
         $attendanceArr[] = $attendanceObj;
     }
     return $attendanceArr;
 }