public function add($host, $ip)
    {
        $this->validHost($host);
        $this->validIp($ip);

        if ($this->check($host)) {
            throw new \RuntimeException('Host already exists in the file');
        }

        $this->backup();

        $record = "\n$ip $host";
        $file = new \SplFileObject($this->filepath, 'a');
        $ok = $file->fwrite($record);

        if (!$ok) {
            throw new \RuntimeException('Could not write to file');
        }

        return true;
    }