def add_entry(opts)
      raise ArgumentError, "Expected Hash or Keepassx::Entry, got #{opts.class}" unless valid_entry?(opts)

      if opts.is_a?(Keepassx::Entry)
        # Add entry
        @entries << opts

        # Increment counter
        header.entries_count += 1

        # Return entry
        opts

      elsif opts.is_a?(Hash)
        opts = deep_copy(opts)
        opts = build_entry_options(opts)

        # Create entry
        entry = create_entry(opts)

        # Increment counter
        header.entries_count += 1

        # Return entry
        entry
      end
    end
def add_entry(opts)
      raise ArgumentError, "Expected Hash or Keepassx::Entry, got #{opts.class}" unless valid_entry?(opts)

      if opts.is_a?(Keepassx::Entry)
        # Add entry
        @entries << opts

        # Increment counter
        header.entries_count += 1

        # Return entry
        opts

      elsif opts.is_a?(Hash)
        opts = deep_copy(opts)
        opts = build_entry_options(opts)

        # Create entry
        entry = create_entry(opts)

        # Increment counter
        header.entries_count += 1

        # Return entry
        entry
      end
    end
rubocop:enable Metrics/MethodLength
 Add new entry to database.

 @param opts [Hash] Options that will be passed to Keepassx::Entry#new.
 @return [Keepassx::Entry]