@Override
    public void addNewPastMeeting(Set<Contact> contacts, Calendar date, String text) {
        int id = 0;
        Calendar now = Calendar.getInstance();
        if (date.getTime().compareTo(now.getTime()) > 0) {
            throw new IllegalArgumentException("Date specified in the future");
            //not checking date as Calendar type object indicates it cannot be null
        } else if (text == null || contacts == null) {
            throw new NullPointerException("One of the parameters is missing");
        } else if (contacts.isEmpty()) {
            throw new IllegalArgumentException("The list of contacts is empty");
        } else {
            for (Contact curr : contacts) {
                if (!allContacts.contains(curr)) {
                    throw new IllegalArgumentException("Contact " + curr.getName() + " does not exist in records");
                }
            }
        }
        /**
         * Check that the same id does not exist already-if yes, regenerate ID
         */
        do {
            id = generateRandomID();
        }
        while (meetingIdExists(id));

        Meeting newPastMeeting = new PastMeetingImpl(id, date, contacts, text);
        //check if the meeting is not a duplicate
        //a meeting is considered duplicate if it has the same contacts and date/time as an existing meeting
        if (!meetingExists(contacts, date)) {
            allMeetings.add(newPastMeeting);
        } else {
            //throws a Runtime exception if a meeting with the same date/time and contacts is in the list already
            throw new IllegalArgumentException("Meeting already exists!");
        }
    }