private function addUsers($users)
    {
        if (!is_array($users)) {
            return false;
        }

        foreach ($users as $username => $data) {
            if ($username == '' || !$this->isString($username)) {
                throw new MemoryException('Cannot store a user that doesn\'t have a username.');
            }

            if (!isset($data['password'])) {
                $data['password'] = '';
            }

            if (!isset($data['roles']) || empty($data['roles'])) {
                $data['roles'] = [];
            } else {
                $data['roles'] = (array)$data['roles'];
            }

            $this->users[$username] = $data;
        }

        return true;
    }