protected function parseAttachments(array $relations)
    {
        $parsedRelations = [];

        foreach ($relations as $key => $relation) {
            if ( ! is_numeric($key)) {
                if (is_callable($relation)) {
                    $parsedRelations[$key] = $this->attachItem($key);
                    $parsedRelations[$key]['class']->with($this->attributes)->filter($relation);
                } else {
                    $parsedRelations[$key] = $this->attachItem($key);
                    $parsedRelations[$key]['class']->with($this->attributes)->bring($relation);
                }
            } else {
                $parsedRelations[$relation] = $this->attachItem($relation);

                if (isset($parsedRelations[$relation]['class'])) {
                    $parsedRelations[$relation]['class']->with($this->attributes);
                }
            }
        }

        return $parsedRelations;
    }