private void addTimeToPrimaryTimeSheets(ArrayList<Time_Sheet> primaryTimesheets, ArrayList<Time_Sheet> currentTimesheets, Timestamp currentTime){
        //Do for all time sheets in primary time sheet
        for(int j = 0; j < primaryTimesheets.size(); j++){

            Timestamp tempEnd = currentTime;
            Time_Sheet currentPrimaryTS = primaryTimesheets.get(j);
            //If the primary timesheet ended before the new current time, then remove it, add minutes and check if any current timesheets are still active.
            if(currentPrimaryTS.getEndTime().getTime() <= currentTime.getTime()){
                tempEnd = currentPrimaryTS.getEndTime();
                long millis = currentPrimaryTS.getEndTime().getTime() - currentPrimaryTS.getStartTimeForCurrentTimeAtAlarm().getTime();
                int minutes = (int) (millis / (60*1000));
                //split the time between all the primary time sheets
                for(Time_Sheet myTS: primaryTimesheets){
                    myTS.addMinute((minutes/primaryTimesheets.size()));
                    myTS.setStartTimeForCurrentTimeAtAlarm(currentPrimaryTS.getEndTime());
                }
                boolean hasAddedNewTimeSheet = false;
                //If it's the last primary time sheet. Then move the last added current time sheet to primary time sheets.
                if(primaryTimesheets.size() == 1 && !currentTimesheets.isEmpty()){
                    
                    removeOldTimeSheets(currentTimesheets, currentPrimaryTS.getEndTime());
                    
                    primaryTimesheets.add(currentTimesheets.get(currentTimesheets.size()-1));
                    j++;
                    primaryTimesheets.get(j).setStartTimeForCurrentTimeAtAlarm(currentPrimaryTS.getEndTime());
                    currentTimesheets.remove(currentTimesheets.size()-1);
                    hasAddedNewTimeSheet = true;
                    
                }
                //Remove the primary time sheet we have calculated time for
                if(hasAddedNewTimeSheet){
                    primaryTimesheets.remove(j-1);
                    j--;
                }else{
                    primaryTimesheets.remove(j);
                    
                }
                j--;
                
            }else{//if the primary time sheet ended after the current time, then add minutes and move it to current time sheets
                
                long millis = tempEnd.getTime() - currentPrimaryTS.getStartTimeForCurrentTimeAtAlarm().getTime();
                int minutes = (int) (millis / (60*1000));
               
                currentPrimaryTS.addMinute(minutes);
                currentPrimaryTS.setStartTimeForCurrentTimeAtAlarm(currentTime);
                currentTimesheets.add(currentPrimaryTS);
                
                primaryTimesheets.remove(j);
                j--;
            }
            
        }
        
    }